We already warned about the lambda, and we don't have a source location for the imagined "auto" anyway.
llvm-svn: 332401
T = SemaRef.Context.IntTy;
D.setInvalidType(true);
- } else if (!HaveTrailing) {
+ } else if (!HaveTrailing &&
+ D.getContext() != DeclaratorContext::LambdaExprContext) {
// If there was a trailing return type, we already got
// warn_cxx98_compat_trailing_return_type in the parser.
+ // If this was a lambda, we already warned on that too.
SemaRef.Diag(AutoRange.getBegin(),
diag::warn_cxx98_compat_auto_type_specifier)
<< AutoRange;
void Lambda() {
[]{}(); // expected-warning {{lambda expressions are incompatible with C++98}}
+ // Don't warn about implicit "-> auto" here.
+ [](){}(); // expected-warning {{lambda expressions are incompatible with C++98}}
}
struct Ctor {