[PATCH] D44480: [Sema] Don't skip function bodies with 'auto' without trailing return type

Nikolai Kosjar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 23:53:38 PDT 2018


nik added a comment.

In https://reviews.llvm.org/D44480#1117147, @cpplearner wrote:

> Does `getAs<AutoType>()` work correctly with function returning `auto&`?


No.  For

  class Foo {} foo;
  auto& return_auto_ref() { return foo; }
  auto r6 = return_auto_ref();

the "getAs<AutoType>()" version will skip the function body and generate an error message on use, but "FD->getReturnType()->getContainedDeducedType()" works fine (will not skip the body, as it should here). OK, so now I have a rough idea what the "Contained" was referring too :)


Repository:
  rL LLVM

https://reviews.llvm.org/D44480





More information about the llvm-commits mailing list