[cfe-dev] clangd and deduced return types
Raymond Glover via cfe-dev
cfe-dev at lists.llvm.org
Thu May 10 12:10:14 PDT 2018
Excellent! Thank you for quick response.
On Thu, May 10, 2018 at 11:37 AM, Haojian Wu <hokein at google.com> wrote:
> 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 https://reviews.llvm.org/D46684.
>
> On Thu, May 10, 2018 at 12:25 AM, Raymond Glover via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
>>
>> Hello,
>>
>> 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"
>>
>> template <typename T>
>> auto fooa(T a) { return a; }
>>
>> int main() {
>> fooa(0); // ok
>> foob(0); // ok
>> fooc(0); // error: function 'fooc<int>' with deduced
>> // return type cannot be used before
>> // it is defined
>> return 0;
>> }
>>
>> -- util.h --
>>
>> template <typename T>
>> auto foob(T a) -> decltype(a) { return a; }
>>
>> template <typename T>
>> auto fooc(T a) { return a; }
>>
>> --
>>
>> Is this a known limitation, or a bad configuration on my part? I'm using a
>> packaged version of clang-tools referencing svn331828.
>>
>> Ray
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
More information about the cfe-dev
mailing list