[cfe-commits] r141685 - /cfe/trunk/test/SemaCXX/cxx0x-compat.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Tue Oct 11 10:38:48 PDT 2011
Author: rsmith
Date: Tue Oct 11 12:38:48 2011
New Revision: 141685
URL: http://llvm.org/viewvc/llvm-project?rev=141685&view=rev
Log:
Add more testing for -Wc++0x-compat warnings.
Added:
cfe/trunk/test/SemaCXX/cxx0x-compat.cpp
Added: cfe/trunk/test/SemaCXX/cxx0x-compat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-compat.cpp?rev=141685&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx0x-compat.cpp (added)
+++ cfe/trunk/test/SemaCXX/cxx0x-compat.cpp Tue Oct 11 12:38:48 2011
@@ -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}}
More information about the cfe-commits
mailing list