]> granicus.if.org Git - clang/commitdiff
[Lit Test] Updated 26 Lit tests to be C++11 compatible.
authorCharles Li <charles_li@playstation.sony.com>
Wed, 11 Nov 2015 19:34:47 +0000 (19:34 +0000)
committerCharles Li <charles_li@playstation.sony.com>
Wed, 11 Nov 2015 19:34:47 +0000 (19:34 +0000)
Expected diagnostics have been expanded to vary by C++ dialect.
RUN line has also been expanded to: default, C++98/03 and C++11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252785 91177308-0d34-0410-b5e6-96231b3b80d8

26 files changed:
test/CXX/class.access/class.friend/p2-cxx03.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
test/CodeGen/ubsan-type-blacklist.cpp
test/FixIt/fixit-vexing-parse.cpp
test/SemaCXX/addr-of-overloaded-function.cpp
test/SemaCXX/const-cast.cpp
test/SemaCXX/convert-to-bool.cpp
test/SemaCXX/copy-initialization.cpp
test/SemaCXX/cxx0x-return-init-list.cpp
test/SemaCXX/decltype-crash.cpp
test/SemaCXX/gnu-flags.cpp
test/SemaCXX/invalid-member-expr.cpp
test/SemaCXX/member-expr.cpp
test/SemaCXX/member-pointer.cpp
test/SemaCXX/new-array-size-conv.cpp
test/SemaCXX/offsetof.cpp
test/SemaCXX/printf-block.cpp
test/SemaCXX/undefined-internal.cpp
test/SemaObjCXX/crash.mm
test/SemaObjCXX/vararg-non-pod.mm
test/SemaTemplate/default-arguments.cpp
test/SemaTemplate/temp_class_spec_neg.cpp
test/SemaTemplate/typename-specifier-4.cpp
test/SemaTemplate/typename-specifier.cpp

index f8cabfd78a8f5b69e977fe54f70a3f4854cea8f2..88b2ea3a9b73216eb9479963c8ae6715f573d006 100644 (file)
@@ -1,7 +1,14 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 template<typename T>
 class X0 {
-  friend T; // expected-warning{{non-class friend type 'T' is a C++11 extension}}
+  friend T;
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2{{non-class friend type 'T' is a C++11 extension}}
+#else
+  // expected-no-diagnostics
+#endif
 };
 
 class X1 { };
index 5d1e6fb85ce9c40506b4858c63cf84b267c09774..08b22c118685a9ad249080cc55daa433a5597d82 100644 (file)
@@ -1,10 +1,15 @@
 // RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -verify -std=c++98 %s
+// RUN: %clang_cc1 -verify -std=c++11 %s
 
 class A {
 public:
   explicit A();
   
-  explicit operator int(); // expected-warning {{explicit conversion functions are a C++11 extension}}
+  explicit operator int();
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2 {{explicit conversion functions are a C++11 extension}}
+#endif
 
   explicit void f0(); // expected-error {{'explicit' can only be applied to a constructor or conversion function}}
   
@@ -12,8 +17,11 @@ public:
 };
 
 explicit A::A() { } // expected-error {{'explicit' can only be specified inside the class definition}}
-explicit A::operator bool() { return false; }  // expected-warning {{explicit conversion functions are a C++11 extension}}\
-                                               // expected-error {{'explicit' can only be specified inside the class definition}}
+explicit A::operator bool() { return false; }
+#if __cplusplus <= 199711L // C++03 or earlier modes
+// expected-warning@-2 {{explicit conversion functions are a C++11 extension}}
+#endif
+// expected-error@-4 {{'explicit' can only be specified inside the class definition}}
 
 class B {
   friend explicit A::A(); // expected-error {{'explicit' is invalid in friend declarations}}
index 40e754082b48a272ee5ed2d8df2d1f2baa0c99db..19406518402ff99efeb77cfec3a1ddba6a31b37f 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 class A {}; // expected-note 4 {{previous use is here}}
 enum E {};
@@ -14,7 +16,10 @@ class A1 {
   friend union A; // expected-error {{use of 'A' with tag type that does not match previous declaration}}
 
   friend enum A; // expected-error {{use of 'A' with tag type that does not match previous declaration}}
-  friend enum E; // expected-warning {{befriending enumeration type 'enum E' is a C++11 extension}}
+  friend enum E; 
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2 {{befriending enumeration type 'enum E' is a C++11 extension}}
+#endif
 };
 
 template <class T> struct B { // expected-note {{previous use is here}}
index 5556f35dbfd0065e983336c25ca16b6ca3d9a951..bfe08a67a416772eaf49f1d9be3b0350dc42c363 100644 (file)
@@ -1,11 +1,24 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 template<class X, class Y, class Z> X f(Y,Z); // expected-note {{candidate template ignored: couldn't infer template argument 'X'}}
 
 void g() {
-  f<int,char*,double>("aa",3.0); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
-  f<int,char*>("aa",3.0); // Z is deduced to be double  \
-                          // expected-warning{{conversion from string literal to 'char *' is deprecated}}
+  f<int,char*,double>("aa",3.0);
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2{{conversion from string literal to 'char *' is deprecated}}
+#else
+  // expected-warning@-4{{ISO C++11 does not allow conversion from string literal to 'char *'}}
+#endif
+
+  f<int,char*>("aa",3.0); // Z is deduced to be double
+#if __cplusplus <= 199711L
+  // expected-warning@-2{{conversion from string literal to 'char *' is deprecated}}
+#else
+  // expected-warning@-4{{ISO C++11 does not allow conversion from string literal to 'char *'}}
+#endif
   f<int>("aa",3.0);       // Y is deduced to be char*, and
                           // Z is deduced to be double 
   f("aa",3.0); // expected-error{{no matching}}
index b3137e7806c76bcc4163a290480bd2a7328693e8..26b7aa877d15d444110db377f03f27437ec26522 100644 (file)
@@ -14,7 +14,7 @@ Bar bar;
 // DEFAULT: @_Z7checkmev
 // TYPE: @_Z7checkmev
 void checkme() {
-// DEFAULT: call void @__ubsan_handle_dynamic_type_cache_miss({{.*}} (%class.Bar* @bar to
+// DEFAULT: call void @__ubsan_handle_dynamic_type_cache_miss({{.*}} ({{.*}}* @bar to
 // TYPE-NOT: @__ubsan_handle_dynamic_type_cache_miss
   Foo* foo = static_cast<Foo*>(&bar); // down-casting
 // DEFAULT: ret void
index 79d8cad6bb9fa1d18259e1a143e3e1daf9fbbcd9..0232f5dbb04e9b6ad5ea10985cea5f030aebe9db 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -verify -x c++ %s
-// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -verify -x c++ -std=c++98 %s
+// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits -x c++ -std=c++98 %s 2>&1 | FileCheck %s
 
 struct S {
   int n;
index 09f280bc1dbb563fc5142e3c9d847f6c4e0c16be..cca847b4d2c32f801405400803dff3b65c281139 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s 
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 
 int f(double); // expected-note{{candidate function}}
 int f(int); // expected-note{{candidate function}}
 
@@ -79,7 +81,10 @@ struct C {
   void q3(); // expected-note{{possible target for call}}
   template<typename T1, typename T2>
   void q4(); // expected-note{{possible target for call}}
-  template<typename T1 = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
+  template<typename T1 = int>
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2{{default template arguments for a function template are a C++11 extension}}
+#endif
   void q5(); // expected-note{{possible target for call}}
 
   void h() {
index 330e18661b197496a5b4cefbe90d6df16b9d98fa..87df61cbc7b2c654426ba1f1897708eb43fdc22e 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 struct A {};
 
@@ -38,8 +40,10 @@ char ***good_const_cast_test(ccvpcvpp var)
   f *fpp = const_cast<f*>(&fp);
   int const A::* const A::*icapcap = 0;
   int A::* A::* iapap = const_cast<int A::* A::*>(icapcap);
-  (void)const_cast<A&&>(A()); // expected-warning {{C++11}}
-
+  (void)const_cast<A&&>(A());
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2 {{rvalue references are a C++11 extension}}
+#endif
   return var4;
 }
 
@@ -61,7 +65,10 @@ short *bad_const_cast_test(char const *volatile *const volatile *var)
   f fp2 = const_cast<f>(fp1); // expected-error {{const_cast to 'f' (aka 'int (*)(int)'), which is not a reference, pointer-to-object, or pointer-to-data-member}}
   void (A::*mfn)() = 0;
   (void)const_cast<void (A::*)()>(mfn); // expected-error-re {{const_cast to 'void (A::*)(){{( __attribute__\(\(thiscall\)\))?}}', which is not a reference, pointer-to-object, or pointer-to-data-member}}
-  (void)const_cast<int&&>(0); // expected-error {{const_cast from rvalue to reference type 'int &&'}} expected-warning {{C++11}}
+  (void)const_cast<int&&>(0); // expected-error {{const_cast from rvalue to reference type 'int &&'}}
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2 {{rvalue references are a C++11 extension}}
+#endif
   return **var3;
 }
 
index b52f11c93d39a40d0575796ad8d52ca53b186cfc..117b50899b7ef9437211c6356049d6552cd941d7 100644 (file)
@@ -1,4 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s 
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
 struct ConvToBool {
   operator bool() const;
 };
@@ -8,7 +11,10 @@ struct ConvToInt {
 };
 
 struct ExplicitConvToBool {
-  explicit operator bool(); // expected-warning{{explicit conversion functions are a C++11 extension}}
+  explicit operator bool();
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2{{explicit conversion functions are a C++11 extension}}
+#endif
 };
 
 void test_conv_to_bool(ConvToBool ctb, ConvToInt cti, ExplicitConvToBool ecb) {
@@ -39,7 +45,10 @@ void test_conv_to_bool(ConvToBool ctb, ConvToInt cti, ExplicitConvToBool ecb) {
 void accepts_bool(bool) { } // expected-note{{candidate function}}
 
 struct ExplicitConvToRef {
-  explicit operator int&(); // expected-warning{{explicit conversion functions are a C++11 extension}}
+  explicit operator int&();
+#if (__cplusplus <= 199711L) // C++03 or earlier modes
+  // expected-warning@-2{{explicit conversion functions are a C++11 extension}}
+#endif
 };
 
 void test_explicit_bool(ExplicitConvToBool ecb) {
@@ -56,7 +65,10 @@ void test_explicit_conv_to_ref(ExplicitConvToRef ecr) {
 struct A { };
 struct B { };
 struct C {
-  explicit operator A&(); // expected-warning{{explicit conversion functions are a C++11 extension}}
+  explicit operator A&(); 
+#if __cplusplus <= 199711L // C++03 or earlier modes
+// expected-warning@-2{{explicit conversion functions are a C++11 extension}}
+#endif
   operator B&(); // expected-note{{candidate}}
 };
 
index ea2db0c68e8580278a14d884cc2c0aae9422eff5..d219ee508f035ad70e34767d5fed10694f9597c1 100644 (file)
@@ -1,4 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s 
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
 class X {
 public:
   explicit X(const X&); // expected-note {{candidate constructor}}
@@ -58,7 +61,10 @@ namespace DR5 {
 
   namespace Ex2 {
     struct S {
-      S(S&&); // expected-warning {{C++11}}
+      S(S&&);
+#if __cplusplus <= 199711L // C++03 or earlier modes
+      // expected-warning@-2 {{rvalue references are a C++11 extension}}
+#endif
       S(int);
     };
     const S a(0);
index 84bd89b210fcc9aa5ec3e5a61490bfeb15fa309a..2aeec7bff7c85fdc62416d7d92258b580a8a9b91 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
 
 // Test that a very basic variation of generalized initializer returns (that
 // required for libstdc++ 4.5) is supported in C++98.
index 002bd4cfe737f110397fadd0d58abee4a1d9dee1..1cebfcd72c86193ec662dd8feb67d4e34bf9a30b 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat -std=c++98 %s
 
 int& a();
 
index 05770c53704ea15c1037ebf05d6efb505f4d2fd3..3cd18cabe9700b5a78a10bdd47b2929d91767fb7 100644 (file)
@@ -1,13 +1,37 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wno-gnu
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DNONE -Wno-gnu
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DNONE -Wno-gnu
+
 // RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wgnu 
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DALL -Wgnu 
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DALL -Wgnu 
+
 // RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wno-gnu \
 // RUN:   -Wgnu-anonymous-struct -Wredeclared-class-member \
 // RUN:   -Wgnu-flexible-array-union-member -Wgnu-folding-constant \
 // RUN:   -Wgnu-empty-struct
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DALL -Wno-gnu \
+// RUN:   -Wgnu-anonymous-struct -Wredeclared-class-member \
+// RUN:   -Wgnu-flexible-array-union-member -Wgnu-folding-constant \
+// RUN:   -Wgnu-empty-struct
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DALL -Wno-gnu \
+// RUN:   -Wgnu-anonymous-struct -Wredeclared-class-member \
+// RUN:   -Wgnu-flexible-array-union-member -Wgnu-folding-constant \
+// RUN:   -Wgnu-empty-struct
+
 // RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wgnu \
 // RUN:   -Wno-gnu-anonymous-struct -Wno-redeclared-class-member \
 // RUN:   -Wno-gnu-flexible-array-union-member -Wno-gnu-folding-constant \
 // RUN:   -Wno-gnu-empty-struct
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DNONE -Wgnu \
+// RUN:   -Wno-gnu-anonymous-struct -Wno-redeclared-class-member \
+// RUN:   -Wno-gnu-flexible-array-union-member -Wno-gnu-folding-constant \
+// RUN:   -Wno-gnu-empty-struct
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DNONE -Wgnu \
+// RUN:   -Wno-gnu-anonymous-struct -Wno-redeclared-class-member \
+// RUN:   -Wno-gnu-flexible-array-union-member -Wno-gnu-folding-constant \
+// RUN:   -Wno-gnu-empty-struct
+
 // Additional disabled tests:
 // %clang_cc1 -fsyntax-only -verify %s -DANONYMOUSSTRUCT -Wno-gnu -Wgnu-anonymous-struct
 // %clang_cc1 -fsyntax-only -verify %s -DREDECLAREDCLASSMEMBER -Wno-gnu -Wredeclared-class-member
@@ -59,7 +83,7 @@ struct faum {
 };
 
 
-#if ALL || FOLDINGCONSTANT
+#if (ALL || FOLDINGCONSTANT) && (__cplusplus <= 199711L) // C++03 or earlier modes
 // expected-warning@+4 {{in-class initializer for static data member is not a constant expression; folding it to a constant is a GNU extension}}
 #endif
 
index 87da79a27c0cbd1d372c0f21c1ecc572f7777734..172be6b8266d699abe4773dfa236d7810ecbed6f 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 class X {};
 
@@ -23,9 +25,17 @@ void test2() {
 // PR6327
 namespace test3 {
   template <class A, class B> struct pair {};
+  template <class _E> class initializer_list {};
+  template <typename _Tp> pair<_Tp, _Tp> minmax(initializer_list<_Tp> __l) {};
 
   void test0() {
-    pair<int, int> z = minmax({}); // expected-error {{expected expression}}
+    pair<int, int> z = minmax({});
+#if __cplusplus <= 199711L // C++03 or earlier modes
+    // expected-error@-2 {{expected expression}}
+#else
+    // expected-error@-4 {{no matching function for call to 'minmax'}}
+    // expected-note@-8 {{candidate template ignored: couldn't infer template argument '_Tp'}}
+#endif
   }
 
   struct string {
index 5b3393efc0cc7b2b05cfee4a367853afa1ff73f2..3571fa748b818dedbffb638d7bcb4e636a824648 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 class X{
 public:
@@ -116,8 +118,10 @@ namespace rdar8231724 {
   void f(Y *y) {
     y->N::X1<int>; // expected-error{{'rdar8231724::N::X1' is not a member of class 'rdar8231724::Y'}}
     y->Z<int>::n; // expected-error{{'rdar8231724::Z<int>::n' is not a member of class 'rdar8231724::Y'}}
-    y->template Z<int>::n; // expected-error{{'rdar8231724::Z<int>::n' is not a member of class 'rdar8231724::Y'}} \
-    // expected-warning{{'template' keyword outside of a template}}
+    y->template Z<int>::n; // expected-error{{'rdar8231724::Z<int>::n' is not a member of class 'rdar8231724::Y'}}
+#if __cplusplus <= 199711L // C++03 or earlier modes
+    // expected-warning@-2{{'template' keyword outside of a template}}
+#endif
   }
 }
 
index afb7455921e7ac43fd7541920ede38f52ca94410..f3adb95977a14efaf1e934144fc73dde307bfc59 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 struct A {};
 enum B { Dummy };
@@ -14,8 +16,11 @@ int (::A::*pdi2);
 int (A::*pfi)(int);
 void (*A::*ppfie)() throw(); // expected-error {{exception specifications are not allowed beyond a single level of indirection}}
 
-int B::*pbi; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
-             // expected-error {{'pbi' does not point into a class}}
+int B::*pbi;
+#if __cplusplus <= 199711L // C++03 or earlier modes
+// expected-warning@-2 {{use of enumeration in a nested name specifier is a C++11 extension}}
+#endif
+// expected-error@-4 {{'pbi' does not point into a class}}
 int C::*pci; // expected-error {{'pci' does not point into a class}}
 void A::*pdv; // expected-error {{'pdv' declared as a member pointer to void}}
 int& A::*pdr; // expected-error {{'pdr' declared as a member pointer to a reference}}
index c987c2820adfda1bd65ed1d5add9cccde24d6e27..dbdd4bd8951e70edceaccca6a737a198dc50138e 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++11 %s
 
 struct ValueInt
 {
@@ -20,8 +22,15 @@ struct TwoValueInts : ValueInt, IndirectValueInt { }; // expected-warning{{direc
 
 
 void test() {
-  (void)new int[ValueInt(10)]; // expected-warning{{implicit conversion from array size expression of type 'ValueInt' to integral type 'int' is a C++11 extension}}
-  (void)new int[ValueEnum()]; // expected-warning{{implicit conversion from array size expression of type 'ValueEnum' to enumeration type 'E' is a C++11 extension}}
+  (void)new int[ValueInt(10)];
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2{{implicit conversion from array size expression of type 'ValueInt' to integral type 'int' is a C++11 extension}}
+#endif
+
+  (void)new int[ValueEnum()];
+#if __cplusplus <= 199711L
+// expected-warning@-2{{implicit conversion from array size expression of type 'ValueEnum' to enumeration type 'E' is a C++11 extension}}
+#endif
   (void)new int[ValueBoth()]; // expected-error{{ambiguous conversion of array size expression of type 'ValueBoth' to an integral or enumeration type}}
 
   (void)new int[TwoValueInts()]; // expected-error{{ambiguous conversion of array size expression of type 'TwoValueInts' to an integral or enumeration type}}
index e6069ac9c0a0708077baace5a94bd8cbd58a62ef..c4b288aa05d43413fd2de484f1e6848aae798068 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -verify %s -Winvalid-offsetof
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -verify %s -Winvalid-offsetof -std=c++98
 
 struct NonPOD {
   virtual void f();
index 4a580037e731413e5dff5062ece1b8aa04c6828d..b9d06d6c4fe779cc944232ff24851779ae617bb3 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -fblocks -Wformat -verify %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wformat -verify %s -Wno-error=non-pod-varargs -std=c++98
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wformat -verify %s -Wno-error=non-pod-varargs -std=c++11
 
 int (^block) (int, const char *,...) __attribute__((__format__(__printf__,2,3))) = ^ __attribute__((__format__(__printf__,2,3))) (int arg, const char *format,...) {return 5;};
 
@@ -14,5 +16,11 @@ void test_block() {
   HasNoCStr hncs(str);
   int n = 4;
   block(n, "%s %d", str, n); // no-warning
-  block(n, "%s %s", hncs, n); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic block; expected type from format string was 'char *'}} expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
+  block(n, "%s %s", hncs, n);
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2{{cannot pass non-POD object of type 'HasNoCStr' to variadic block; expected type from format string was 'char *'}}
+#else
+  // expected-warning@-4{{format specifies type 'char *' but the argument has type 'HasNoCStr'}}
+#endif
+  // expected-warning@-6{{format specifies type 'char *' but the argument has type 'int'}}
 }
index 0138967ef80ce4f160900057a1da1c253ee1d7b5..29ca5de6d41cdad440794484b2116ed0ba35f760 100644 (file)
@@ -1,7 +1,11 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wbind-to-temporary-copy %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wbind-to-temporary-copy -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wbind-to-temporary-copy -std=c++11 %s
 
 // Make sure we don't produce invalid IR.
 // RUN: %clang_cc1 -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only -std=c++98 %s
+// RUN: %clang_cc1 -emit-llvm-only -std=c++11 %s
 
 namespace test1 {
   static void foo(); // expected-warning {{function 'test1::foo' has internal linkage but is not defined}}
@@ -119,7 +123,12 @@ namespace PR9323 {
   }
   void f(const Uncopyable&) {}
   void test() {
-    f(Uncopyable()); // expected-warning {{C++98 requires an accessible copy constructor}}
+    f(Uncopyable()); 
+#if __cplusplus <= 199711L // C++03 or earlier modes
+    // expected-warning@-2 {{C++98 requires an accessible copy constructor}}
+#else
+    // expected-warning@-4 {{copying parameter of type 'PR9323::(anonymous namespace)::Uncopyable' when binding a reference to a temporary would invoke an inaccessible constructor in C++98}}
+#endif
   };
 }
 
index 521b923cc00d2802e6790d62d79abd03b8dc9a96..19cf3099828ac54fbbe37a4602eca10a3af437ca 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only %s -verify 
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 %s -verify 
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify 
 
 // <rdar://problem/11286701>
 namespace std {
@@ -18,6 +20,8 @@ struct EvilStruct {
 
   typedef std::pair<int, int> IntegerPair;
 
-template<typename...Ts> void f(Ts); // expected-error {{unexpanded}} expected-warning {{extension}}
-
+template<typename...Ts> void f(Ts); // expected-error {{unexpanded}}
+#if __cplusplus <= 199711L // C++03 or earlier modes
+// expected-warning@-2 {{variadic templates are a C++11 extension}}
+#endif
 @end
index 5a6281d71cb2f71ea05d4d4bdbf07022ec5dbf79..daf9aa92b54e549f10d38a2a469d0bdd01addc46 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-error=non-pod-varargs -std=c++98
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-error=non-pod-varargs -std=c++11
 
 extern char version[];
 
@@ -17,7 +19,12 @@ void t1(D *d)
 {
   C c(10);
 
-  [d g:10, c]; // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+  [d g:10, c]; 
+#if __cplusplus <= 199711L // C++03 or earlier modes
+  // expected-warning@-2{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+#else
+  // expected-no-diagnostics@-4
+#endif
   [d g:10, version];
 }
 
index 37d144b7197195778fce288574f1c521c9dd0ee8..740a5a9d07b33d2a16bdfd7fd8288c08f03ec298 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 template<typename T, int N = 2> struct X; // expected-note{{template is declared here}}
 
 X<int, 1> *x1;
@@ -142,7 +144,10 @@ namespace PR9643 {
 namespace PR16288 {
   template<typename X>
   struct S {
-    template<typename T = int, typename U> // expected-warning {{C++11}}
+    template<typename T = int, typename U>
+#if __cplusplus <= 199711L // C++03 or earlier modes
+    // expected-warning@-2 {{default template arguments for a function template are a C++11 extension}}
+#endif
     void f();
   };
   template<typename X>
@@ -152,8 +157,10 @@ namespace PR16288 {
 
 namespace DR1635 {
   template <class T> struct X {
-    template <class U = typename T::type> static void f(int) {} // expected-error {{type 'int' cannot be used prior to '::' because it has no members}} \
-                                                                // expected-warning {{C++11}}
+    template <class U = typename T::type> static void f(int) {} // expected-error {{type 'int' cannot be used prior to '::' because it has no members}}
+#if __cplusplus <= 199711L // C++03 or earlier modes
+    // expected-warning@-2 {{default template arguments for a function template are a C++11 extension}}
+#endif
     static void f(...) {}
   };
 
index be5fbb154ea82a0acdbb03417406a136ddf812bf..1c77038ab8a9a0c6504bbdaaed304f1d2dd514b7 100644 (file)
@@ -1,15 +1,23 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 template<typename T> struct vector;
 
 // C++ [temp.class.spec]p6:
 namespace N {
   namespace M {
-    template<typename T> struct A; // expected-note{{here}}
+    template<typename T> struct A;
+#if __cplusplus <= 199711L // C++03 or earlier modes
+    // expected-note@-2{{explicitly specialized declaration is here}}
+#endif
   }
 }
 
 template<typename T>
-struct N::M::A<T*> { }; // expected-warning{{C++11 extension}}
+struct N::M::A<T*> { };
+#if __cplusplus <= 199711L
+// expected-warning@-2{{first declaration of class template partial specialization of 'A' outside namespace 'M' is a C++11 extension}}
+#endif
 
 // C++ [temp.class.spec]p9
 //   bullet 1
index 44cf966e33b593e0e2b5a3a82c459db64f9815f0..2856c99b6ddf4e7dbd6b96ed3d288a8774457737 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 template<typename T, typename U> 
 struct is_same {
   static const bool value = false;
@@ -27,8 +29,11 @@ struct make_pair {
 int a0[is_same<metafun_apply2<make_pair, int, float>::type, 
                pair<int, float> >::value? 1 : -1];
 int a1[is_same<
-         typename make_pair::template apply<int, float>, // expected-warning{{'template' keyword outside of a template}} \
-       // expected-warning{{'typename' occurs outside of a template}}
+         typename make_pair::template apply<int, float>, 
+#if __cplusplus <= 199711L // C++03 and earlier modes
+         // expected-warning@-2 {{'template' keyword outside of a template}}
+         // expected-warning@-3 {{'typename' occurs outside of a template}}
+#endif
          make_pair::apply<int, float>
        >::value? 1 : -1];
 
index 602e9030636d028b08f70c9311571e8d8c79ad66..b36a103b65ae3cf5864ebce8a41255411420605e 100644 (file)
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unused
 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unused -fms-compatibility -DMSVC
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wno-unused
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wno-unused -fms-compatibility -DMSVC
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused -fms-compatibility -DMSVC
 namespace N {
   struct A {
     typedef int type;
@@ -16,22 +20,38 @@ namespace N {
 
 int i;
 
-typename N::A::type *ip1 = &i; // expected-warning{{'typename' occurs outside of a template}}
-typename N::B::type *ip2 = &i; // expected-error{{no type named 'type' in 'N::B'}} \
-// expected-warning{{'typename' occurs outside of a template}}
-typename N::C::type *ip3 = &i; // expected-error{{typename specifier refers to non-type member 'type'}} \
-// expected-warning{{'typename' occurs outside of a template}}
+typename N::A::type *ip1 = &i;
+#if __cplusplus <= 199711L // C++03 or earlier modes
+// expected-warning@-2 {{'typename' occurs outside of a template}}
+#endif
+typename N::B::type *ip2 = &i; // expected-error{{no type named 'type' in 'N::B'}}
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{'typename' occurs outside of a template}}
+#endif
+typename N::C::type *ip3 = &i; // expected-error{{typename specifier refers to non-type member 'type'}}
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{'typename' occurs outside of a template}}
+#endif
 
 void test(double d) {
-  typename N::A::type f(typename N::A::type(a)); // expected-warning{{disambiguated as a function declaration}} \
-  // expected-note{{add a pair of parentheses}} expected-warning 2{{'typename' occurs outside of a template}}
+  typename N::A::type f(typename N::A::type(a)); // expected-warning{{disambiguated as a function declaration}}
+  // expected-note@-1 {{add a pair of parentheses}}
+#if __cplusplus <= 199711L
+  // expected-warning@-3 2{{'typename' occurs outside of a template}}
+#endif
   int five = f(5);
   
   using namespace N;
-  for (typename A::type i = 0; i < 10; ++i) // expected-warning{{'typename' occurs outside of a template}}
+  for (typename A::type i = 0; i < 10; ++i)
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{'typename' occurs outside of a template}}
+#endif
     five += 1;
 
-  const typename N::A::type f2(d); // expected-warning{{'typename' occurs outside of a template}}
+  const typename N::A::type f2(d);
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{'typename' occurs outside of a template}}
+#endif
 }
 
 namespace N {