clangd and deduced return types


I have recently started clangd and had immediate success. However my project has a dependency which makes good use of c++14 return type deduction for functions, which when used create errors that prevent me from using the “go to definition” feature in my IDE. Here is a minimal example containing two files:

– main.cpp –

#include “util.h”

auto fooa(T a) { return a; }

int main() {
fooa(0); // ok
foob(0); // ok
fooc(0); // error: function ‘fooc’ with deduced
// return type cannot be used before
// it is defined
return 0;

– util.h –

auto foob(T a) → decltype(a) { return a; }

auto fooc(T a) { return a; }

Hello Ray,

Thanks for the report. Yeah, it is an issue of “SkipFunctionBody” when building the AST (in your “fooc” case, we need to see the function body before using it), I have sent out a fix

Excellent! Thank you for quick response.