[PATCH] D44480: [Sema] Don't skip function bodies with 'auto' without trailing return type
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 11 12:00:52 PDT 2018
rsmith added a comment.
Thanks, I think this can be simplified a bit but this looks like the right fix.
================
Comment at: lib/Sema/SemaDecl.cpp:12609-12610
return false;
+ // We can't simply call Type::isUndeducedType here, because it returns
+ // false on C++14's auto return type without trailing return type.
+ DeducedType *DT = FD->getReturnType()->getContainedDeducedType();
----------------
I don't think this comment captures the problem. Rather, I think the problem is that in a template we deduce the `auto` to a dependent type, so it's not considered "undeduced" at the point when we ask this question.
================
Comment at: lib/Sema/SemaDecl.cpp:12612-12613
+ DeducedType *DT = FD->getReturnType()->getContainedDeducedType();
+ if (DT && DT->getDeducedType().isNull())
+ return false;
+ }
----------------
Is there any need to check whether the type has been deduced here? It seems simpler (and equivalent) to turn off skipping for functions whose return type involves a deduced type regardless of whether deduction has been performed already (which it hasn't).
Repository:
rC Clang
https://reviews.llvm.org/D44480
More information about the cfe-commits
mailing list