diff options
Diffstat (limited to 'clang/test/SemaCXX/cxx98-compat.cpp')
| -rw-r--r-- | clang/test/SemaCXX/cxx98-compat.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp index 26882321220..8ac3234411b 100644 --- a/clang/test/SemaCXX/cxx98-compat.cpp +++ b/clang/test/SemaCXX/cxx98-compat.cpp @@ -323,3 +323,21 @@ namespace NonTypeTemplateArgs { S<const int&, k> s1; // expected-warning {{non-type template argument referring to object 'k' with internal linkage is incompatible with C++98}} S<void(&)(), f> s2; // expected-warning {{non-type template argument referring to function 'f' with internal linkage is incompatible with C++98}} } + +namespace ThisInExceptionSpec { + template<int> struct T {}; + struct S { + int n; + void f() throw (T<sizeof(n)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}} + void g() throw (T<sizeof(S::n)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}} + void h() throw (T<sizeof(this)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}} + }; +} + +namespace NullPointerTemplateArg { + struct A {}; + template<int*> struct X {}; + template<int A::*> struct Y {}; + X<(int*)0> x; // expected-warning {{use of null pointer as non-type template argument is incompatible with C++98}} + Y<(int A::*)0> y; // expected-warning {{use of null pointer as non-type template argument is incompatible with C++98}} +} |

