It's not safe to blindly call getIdentifierInfo without checking the
token is not an annotation token.
llvm-svn: 225533
switch (Tok.getKind()) {
default:
// Identifiers and keywords have identifier info attached.
- if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
- Loc = ConsumeToken();
- return II;
+ if (!Tok.isAnnotation()) {
+ if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
+ Loc = ConsumeToken();
+ return II;
+ }
}
return nullptr;
[[deprecated()]] void foo(); // expected-error {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}}
[[gnu::deprecated()]] void quux();
}
+
+namespace {
+[[ // expected-error {{expected ']'}}
+#pragma pack(pop)
+deprecated
+]] void bad();
+}