summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp5
-rw-r--r--clang/test/SemaCXX/ms-novtable.cpp1
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 10ae450fe89..445967bfab8 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -1085,6 +1085,11 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
// compatible with GCC.
MaybeParseGNUAttributes(Attr, &DeclEndLoc);
+ // MSVC-style attributes must be parsed before the mutable specifier to be
+ // compatible with MSVC.
+ while (Tok.is(tok::kw___declspec))
+ ParseMicrosoftDeclSpec(Attr);
+
// Parse 'mutable'[opt].
SourceLocation MutableLoc;
if (TryConsumeToken(tok::kw_mutable, MutableLoc))
diff --git a/clang/test/SemaCXX/ms-novtable.cpp b/clang/test/SemaCXX/ms-novtable.cpp
index 6dd949d57db..2d55c48df3c 100644
--- a/clang/test/SemaCXX/ms-novtable.cpp
+++ b/clang/test/SemaCXX/ms-novtable.cpp
@@ -4,3 +4,4 @@ struct __declspec(novtable) S {};
enum __declspec(novtable) E {}; // expected-warning{{'novtable' attribute only applies to classes}}
int __declspec(novtable) I; // expected-warning{{'novtable' attribute only applies to classes}}
typedef struct T __declspec(novtable) U; // expected-warning{{'novtable' attribute only applies to classes}}
+auto z = []() __declspec(novtable) { return nullptr; }; // expected-warning{{'novtable' attribute only applies to classes}}
OpenPOWER on IntegriCloud