File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -9543,6 +9543,8 @@ void Tokenizer::simplifyCPPAttribute()
95439543 Token* head = skipCPPOrAlignAttribute (tok)->next ();
95449544 while (isCPPAttribute (head) || isAlignAttribute (head))
95459545 head = skipCPPOrAlignAttribute (head)->next ();
9546+ if (!head)
9547+ syntaxError (tok);
95469548 head->isAttributeMaybeUnused (true );
95479549 } else if (Token::findsimplematch (tok->tokAt (2 ), " unused" , tok->link ())) {
95489550 Token* head = skipCPPOrAlignAttribute (tok)->next ();
Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ class TestGarbage : public TestFixture {
257257 TEST_CASE (garbageCode226);
258258 TEST_CASE (garbageCode227);
259259 TEST_CASE (garbageCode228);
260+ TEST_CASE (garbageCode229);
260261
261262 TEST_CASE (garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1
262263
@@ -1768,6 +1769,10 @@ class TestGarbage : public TestFixture {
17681769 ASSERT_NO_THROW (checkCode (" void f() { enum { A = [=]() mutable { return 0; }() }; }" ));
17691770 ASSERT_NO_THROW (checkCode (" enum { A = [=](void) mutable -> int { return 0; }() };" ));
17701771 }
1772+ void garbageCode229 () { // #14126
1773+ ASSERT_THROW_INTERNAL (checkCode (" void f() {} [[maybe_unused]]" ), SYNTAX);
1774+ }
1775+
17711776
17721777 void syntaxErrorFirstToken () {
17731778 ASSERT_THROW_INTERNAL (checkCode (" &operator(){[]};" ), SYNTAX); // #7818
You can’t perform that action at this time.
0 commit comments