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()
9543
9543
Token* head = skipCPPOrAlignAttribute (tok)->next ();
9544
9544
while (isCPPAttribute (head) || isAlignAttribute (head))
9545
9545
head = skipCPPOrAlignAttribute (head)->next ();
9546
+ if (!head)
9547
+ syntaxError (tok);
9546
9548
head->isAttributeMaybeUnused (true );
9547
9549
} else if (Token::findsimplematch (tok->tokAt (2 ), " unused" , tok->link ())) {
9548
9550
Token* head = skipCPPOrAlignAttribute (tok)->next ();
Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ class TestGarbage : public TestFixture {
257
257
TEST_CASE (garbageCode226);
258
258
TEST_CASE (garbageCode227);
259
259
TEST_CASE (garbageCode228);
260
+ TEST_CASE (garbageCode229);
260
261
261
262
TEST_CASE (garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1
262
263
@@ -1768,6 +1769,10 @@ class TestGarbage : public TestFixture {
1768
1769
ASSERT_NO_THROW (checkCode (" void f() { enum { A = [=]() mutable { return 0; }() }; }" ));
1769
1770
ASSERT_NO_THROW (checkCode (" enum { A = [=](void) mutable -> int { return 0; }() };" ));
1770
1771
}
1772
+ void garbageCode229 () { // #14126
1773
+ ASSERT_THROW_INTERNAL (checkCode (" void f() {} [[maybe_unused]]" ), SYNTAX);
1774
+ }
1775
+
1771
1776
1772
1777
void syntaxErrorFirstToken () {
1773
1778
ASSERT_THROW_INTERNAL (checkCode (" &operator(){[]};" ), SYNTAX); // #7818
You can’t perform that action at this time.
0 commit comments