Parse: Handle __declspec in a lambda definition

llvm-svn: 228121
This commit is contained in:
David Majnemer 2015-02-04 08:22:46 +00:00
parent 631a90b6bc
commit bda8632f9b
2 changed files with 6 additions and 0 deletions

View File

@ -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))

View File

@ -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}}