File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ void CheckExceptionSafety::deallocThrow()
9393 tok = tok->next ();
9494 if (Token::simpleMatch (tok, " [ ]" ))
9595 tok = tok->tokAt (2 );
96- if (!tok)
96+ if (!tok || tok == scope-> classEnd )
9797 break ;
9898 if (!Token::Match (tok, " %var% ;" ))
9999 continue ;
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ class TestExceptionSafety : public TestFixture {
4949 TEST_CASE (nothrowAttributeThrow);
5050 TEST_CASE (nothrowAttributeThrow2); // #5703
5151 TEST_CASE (nothrowDeclspecThrow);
52+
53+ TEST_CASE (garbage);
5254 }
5355
5456 void check (const char code[], bool inconclusive = false ) {
@@ -411,6 +413,10 @@ class TestExceptionSafety : public TestFixture {
411413 check (" const char *func() __attribute((nothrow)); void func1() { return 0; }\n " );
412414 ASSERT_EQUALS (" " , errout.str ());
413415 }
416+
417+ void garbage () {
418+ check (" { } A() { delete }" ); // #6080
419+ }
414420};
415421
416422REGISTER_TEST (TestExceptionSafety)
You can’t perform that action at this time.
0 commit comments