summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-10-11 17:38:48 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-10-11 17:38:48 +0000
commit81285496846bc091d8f39db45eab6a363f490fa6 (patch)
tree2a5ab8ef4b1f1242d97305562a1e5f8a561273ac
parent27c579dba41fa5b1d4cea9f5646a57466619f89c (diff)
downloadbcm5719-llvm-81285496846bc091d8f39db45eab6a363f490fa6.tar.gz
bcm5719-llvm-81285496846bc091d8f39db45eab6a363f490fa6.zip
Add more testing for -Wc++0x-compat warnings.
llvm-svn: 141685
-rw-r--r--clang/test/SemaCXX/cxx0x-compat.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx0x-compat.cpp b/clang/test/SemaCXX/cxx0x-compat.cpp
new file mode 100644
index 00000000000..1c4cbb2134e
--- /dev/null
+++ b/clang/test/SemaCXX/cxx0x-compat.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++0x-compat -verify %s
+
+namespace N {
+ template<typename T> void f(T) {} // expected-note {{here}}
+ namespace M {
+ template void f<int>(int); // expected-warning {{explicit instantiation of 'N::f' must occur in namespace 'N'}}
+ }
+}
+
+template<typename T> void f(T) {} // expected-note {{here}}
+namespace M {
+ template void f<int>(int); // expected-warning {{explicit instantiation of 'f' must occur in the global namespace}}
+}
+
+void f() {
+ auto int n = 0; // expected-warning {{'auto' storage class specifier is redundant and incompatible with C++0x}}
+}
+
+int n;
+struct S {
+ char c;
+}
+s = { n }, // expected-warning {{non-constant-expression cannot be narrowed from type 'int' to 'char' in initializer list in C++0x}} expected-note {{explicit cast}}
+t = { 1234 }; // expected-warning {{constant expression evaluates to 1234 which cannot be narrowed to type 'char' in C++0x}} expected-warning {{changes value}} expected-note {{explicit cast}}
OpenPOWER on IntegriCloud