diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:03:23 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:03:23 +0000 | 
| commit | 0dc0969cd0a732760f0aa79942a04e0eaef297c4 (patch) | |
| tree | 051bdb57b1ac6ee143f61ddbb47bd0da619f6f0c /test/std/language.support/support.exception | |
| parent | 868847c6900e575417c03bced6e562b3af891318 (diff) | |
Notes
Diffstat (limited to 'test/std/language.support/support.exception')
| -rw-r--r-- | test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp | 33 | ||||
| -rw-r--r-- | test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp | 10 | 
2 files changed, 42 insertions, 1 deletions
| diff --git a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp index 57d193a411cc..68cd85038b28 100644 --- a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp @@ -46,12 +46,19 @@ public:  	C * operator&() const { assert(false); } // should not be called  }; +class D : private std::nested_exception {}; + + +class E1 : public std::nested_exception {}; +class E2 : public std::nested_exception {}; +class E : public E1, public E2 {}; +  int main()  {      {          try          { -            A a(3); +            A a(3);  // not a polymorphic type --> no effect              std::rethrow_if_nested(a);              assert(true);          } @@ -63,6 +70,30 @@ int main()      {          try          { +            D s;  // inaccessible base class --> no effect +            std::rethrow_if_nested(s); +            assert(true); +        } +        catch (...) +        { +            assert(false); +        } +    } +    { +        try +        { +            E s;  // ambiguous base class --> no effect +            std::rethrow_if_nested(s); +            assert(true); +        } +        catch (...) +        { +            assert(false); +        } +    } +    { +        try +        {              throw B(5);          }          catch (const B& b) diff --git a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp index a86d8bcbe201..26be4db38fba 100644 --- a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp @@ -107,6 +107,16 @@ int main()              assert(i == 7);          }      } +    { +        try +        { +            std::throw_with_nested("String literal"); +            assert(false); +        } +        catch (const char * s) +        { +        } +    }  #if TEST_STD_VER > 11      {          try | 
