Two missing -Wc++98-compat warnings, for null pointers as non-type template
arguments, and 'this' in exception-specifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155606 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/cxx98-compat.cpp b/test/SemaCXX/cxx98-compat.cpp
index 2688232..8ac3234 100644
--- a/test/SemaCXX/cxx98-compat.cpp
+++ b/test/SemaCXX/cxx98-compat.cpp
@@ -323,3 +323,21 @@
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}}
+}