diff options
Diffstat (limited to 'test/SemaCXX/exceptions.cpp')
-rw-r--r-- | test/SemaCXX/exceptions.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp index 9802a1a1d620..9e76783ca8a9 100644 --- a/test/SemaCXX/exceptions.cpp +++ b/test/SemaCXX/exceptions.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s struct A; // expected-note 4 {{forward declaration of 'A'}} @@ -135,16 +137,29 @@ namespace Decay { void f() throw (int*, int()); template<typename T> struct C { - void f() throw (T); // expected-error {{pointer to incomplete type 'Decay::E' is not allowed in exception specification}} + void f() throw (T); +#if __cplusplus <= 199711L + // expected-error@-2 {{pointer to incomplete type 'Decay::E' is not allowed in exception specification}} +#endif }; struct D { C<D[10]> c; }; - struct E; // expected-note {{forward declaration}} - C<E[10]> e; // expected-note {{in instantiation of}} + struct E; +#if __cplusplus <= 199711L + // expected-note@-2 {{forward declaration of 'Decay::E'}} +#endif + + C<E[10]> e; +#if __cplusplus <= 199711L + // expected-note@-2 {{in instantiation of template class 'Decay::C<Decay::E [10]>' requested here}} +#endif } -void rval_ref() throw (int &&); // expected-error {{rvalue reference type 'int &&' is not allowed in exception specification}} expected-warning {{C++11}} +void rval_ref() throw (int &&); // expected-error {{rvalue reference type 'int &&' is not allowed in exception specification}} +#if __cplusplus <= 199711L +// expected-warning@-2 {{rvalue references are a C++11 extension}} +#endif namespace HandlerInversion { struct B {}; @@ -253,3 +268,17 @@ void g() { } } } + +namespace PR28047 { +void test1(int i) { + try { + } catch (int(*)[i]) { // expected-error{{cannot catch variably modified type}} + } +} +void test2() { + int i; + try { + } catch (int(*)[i]) { // expected-error{{cannot catch variably modified type}} + } +} +} |