File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed
Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -9550,6 +9550,8 @@ void Tokenizer::simplifyCPPAttribute()
95509550 Token* head = skipCPPOrAlignAttribute (tok)->next ();
95519551 while (isCPPAttribute (head) || isAlignAttribute (head))
95529552 head = skipCPPOrAlignAttribute (head)->next ();
9553+ if (!head)
9554+ syntaxError (tok);
95539555 head->isAttributeUnused (true );
95549556 } else if (Token::Match (tok->previous (), " ) [ [ expects|ensures|assert default|audit|axiom| : %name% <|<=|>|>= %num% ] ]" )) {
95559557 const Token *vartok = tok->tokAt (4 );
Original file line number Diff line number Diff line change @@ -1771,6 +1771,7 @@ class TestGarbage : public TestFixture {
17711771 }
17721772 void garbageCode229 () { // #14126
17731773 ASSERT_THROW_INTERNAL (checkCode (" void f() {} [[maybe_unused]]" ), SYNTAX);
1774+ ASSERT_THROW_INTERNAL (checkCode (" void f() {} [[unused]]" ), SYNTAX);
17741775 }
17751776
17761777
You can’t perform that action at this time.
0 commit comments