summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaType.cpp4
-rw-r--r--clang/test/SemaCXX/cxx98-compat.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index b13570f97bf..b51d49461fe 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -2962,9 +2962,11 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
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;
diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp
index 33516f70687..ed2666036a1 100644
--- a/clang/test/SemaCXX/cxx98-compat.cpp
+++ b/clang/test/SemaCXX/cxx98-compat.cpp
@@ -47,6 +47,8 @@ namespace TemplateParsing {
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 {
OpenPOWER on IntegriCloud