@@ -44,7 +44,8 @@ class TestExceptionSafety : public TestFixture {
4444 TEST_CASE (catchExceptionByValue);
4545 TEST_CASE (noexceptThrow);
4646 TEST_CASE (nothrowThrow);
47- TEST_CASE (unhandledExceptionSpecification); // #4800
47+ TEST_CASE (unhandledExceptionSpecification1); // #4800
48+ TEST_CASE (unhandledExceptionSpecification2);
4849 TEST_CASE (nothrowAttributeThrow);
4950 TEST_CASE (nothrowAttributeThrow2); // #5703
5051 }
@@ -344,7 +345,7 @@ class TestExceptionSafety : public TestFixture {
344345 ASSERT_EQUALS (" " , errout.str ());
345346 }
346347
347- void unhandledExceptionSpecification () { // #4800
348+ void unhandledExceptionSpecification1 () { // #4800
348349 check (" void myThrowingFoo() throw(MyException) {\n "
349350 " throw MyException();\n "
350351 " }\n "
@@ -359,6 +360,15 @@ class TestExceptionSafety : public TestFixture {
359360 ASSERT_EQUALS (" [test.cpp:5] -> [test.cpp:1]: (warning) Unhandled exception specification when calling function myThrowingFoo().\n " , errout.str ());
360361 }
361362
363+ void unhandledExceptionSpecification2 () {
364+ check (" void f() const throw (std::runtime_error);\n "
365+ " int main()\n "
366+ " {\n "
367+ " f();\n "
368+ " }\n " );
369+ ASSERT_EQUALS (" " , errout.str ());
370+ }
371+
362372 void nothrowAttributeThrow () {
363373 check (" void func1() throw(int) { throw 1; }\n "
364374 " void func2() __attribute((nothrow)); void func1() { throw 1; }\n "
0 commit comments