diff options
Diffstat (limited to 'test/SemaCXX/exceptions.cpp')
-rw-r--r-- | test/SemaCXX/exceptions.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp index 2ed4bfe885623..18349d10ef71c 100644 --- a/test/SemaCXX/exceptions.cpp +++ b/test/SemaCXX/exceptions.cpp @@ -97,3 +97,26 @@ BadReturn::BadReturn(int) try { } } } + +// Cannot throw an abstract type. +class foo { +public: + foo() {} + void bar () { + throw *this; // expected-error{{cannot throw an object of abstract type 'foo'}} + } + virtual void test () = 0; // expected-note{{pure virtual function 'test'}} +}; + +namespace PR6831 { + namespace NA { struct S; } + namespace NB { struct S; } + + void f() { + using namespace NA; + using namespace NB; + try { + } catch (int S) { + } + } +} |