-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"lambdaC++11 lambda expressionsC++11 lambda expressions
Description
This is an issue for the bug from #108598
This code:
template<typename T>
constexpr T outer() {
return []<T x>() { return x; }.template operator()<123>();
}
static_assert(outer<int>() == 123);ends up with a dependent type that we assert on in codegen.
This starts when we deduce the type of the call operator, which is dependent in C++11 but auto in later versions:
llvm-project/clang/lib/Sema/SemaType.cpp
Lines 958 to 973 in 7b88e75
| case DeclSpec::TST_unspecified: | |
| // If this is a missing declspec in a block literal return context, then it | |
| // is inferred from the return statements inside the block. | |
| // The declspec is always missing in a lambda expr context; it is either | |
| // specified with a trailing return type or inferred. | |
| if (S.getLangOpts().CPlusPlus14 && | |
| declarator.getContext() == DeclaratorContext::LambdaExpr) { | |
| // In C++1y, a lambda's implicit return type is 'auto'. | |
| Result = Context.getAutoDeductType(); | |
| break; | |
| } else if (declarator.getContext() == DeclaratorContext::LambdaExpr || | |
| checkOmittedBlockReturnType(S, declarator, | |
| Context.DependentTy)) { | |
| Result = Context.DependentTy; | |
| break; | |
| } |
and we never seem to clean this up.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"lambdaC++11 lambda expressionsC++11 lambda expressions