Index: test/Modules/Inputs/merge-using-decls/a.h =================================================================== --- test/Modules/Inputs/merge-using-decls/a.h +++ test/Modules/Inputs/merge-using-decls/a.h @@ -22,12 +22,14 @@ using typename X::t; }; +#if __cplusplus <= 199711L // C++11 does not allow access declerations template struct E : X, T { using T::value; using typename T::type; using X::v; using typename X::t; }; +#endif template struct F : X, T { using T::value; @@ -39,5 +41,9 @@ // Force instantiation. typedef C::type I; typedef D::type I; + +#if __cplusplus <= 199711L // C++11 does not allow access declerations typedef E::type I; +#endif + typedef F::type I; Index: test/Modules/Inputs/merge-using-decls/b.h =================================================================== --- test/Modules/Inputs/merge-using-decls/b.h +++ test/Modules/Inputs/merge-using-decls/b.h @@ -29,11 +29,13 @@ using typename X::t; }; +#if __cplusplus <= 199711L // C++11 does not allow access declerations template struct E : X, T { // Mismatch in using/access-declaration-ness. T::value; X::v; }; +#endif template struct F : X, T { // Mismatch in nested-name-specifier. @@ -46,5 +48,9 @@ // Force instantiation. typedef C::type I; typedef D::t I; + +#if __cplusplus <= 199711L // C++11 does not allow access declerations typedef E::type I; +#endif + typedef F::type I; Index: test/Modules/merge-using-decls.cpp =================================================================== --- test/Modules/merge-using-decls.cpp +++ test/Modules/merge-using-decls.cpp @@ -1,6 +1,10 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=1 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2 #if ORDER == 1 #include "a.h" @@ -24,7 +28,11 @@ } template int UseAll() { +#if __cplusplus <= 199711L // C++11 does not allow access declerations return Use >() + Use >() + Use >() + Use >(); // expected-note 0-2{{instantiation of}} +#else + return Use >() + Use >() + Use >(); // expected-note 0-2{{instantiation of}} +#endif } template int UseAll(); @@ -37,8 +45,10 @@ // Here, we're instantiating the definition from 'A' and merging the definition // from 'B' into it. +#if __cplusplus <= 199711L // C++11 does not allow access declerations // expected-error@b.h:* {{'E::value' from module 'B' is not present in definition of 'E' in module 'A'}} // expected-error@b.h:* {{'E::v' from module 'B' is not present in definition of 'E' in module 'A'}} +#endif // expected-error@b.h:* {{'F::type' from module 'B' is not present in definition of 'F' in module 'A'}} // expected-error@b.h:* {{'F::t' from module 'B' is not present in definition of 'F' in module 'A'}} @@ -55,11 +65,14 @@ // expected-error@b.h:* 2{{'typename' keyword used on a non-type}} // expected-error@b.h:* 2{{dependent using declaration resolved to type without 'typename'}} +#if __cplusplus <= 199711L // C++11 does not allow access declerations // expected-error@a.h:* {{'E::type' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::t' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::value' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::v' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-note@b.h:* 2{{definition has no member}} +#endif + // expected-error@a.h:* {{'F::type' from module 'A' is not present in definition of 'F' in module 'B'}} // expected-error@a.h:* {{'F::t' from module 'A' is not present in definition of 'F' in module 'B'}} Index: test/OpenMP/declare_reduction_messages.cpp =================================================================== --- test/OpenMP/declare_reduction_messages.cpp +++ test/OpenMP/declare_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s int temp; // expected-note 7 {{'temp' declared here}} @@ -51,7 +53,17 @@ #pragma omp declare reduction(fun222 : long : omp_out += omp_in) // expected-error {{redefinition of user-defined reduction for type 'long'}} #pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer // expected-error {{expected '(' after 'initializer'}} #pragma omp declare reduction(fun2 : long : omp_out += omp_in) initializer { // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} -#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[ // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} +#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[ +#if __cplusplus <= 199711L +// expected-error@-2 {{expected '(' after 'initializer'}} +// expected-error@-3 {{expected expression}} +// expected-warning@-4 {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} +#else +// expected-error@-6 {{expected '(' after 'initializer'}} +// expected-error@-7 {{expected variable name or 'this' in lambda capture list}} +// expected-error@-8 {{expected ')'}} +// expected-note@-9 {{to match this '('}} +#endif #pragma omp declare reduction(fun4 : long : omp_out += omp_in) initializer() // expected-error {{expected expression}} #pragma omp declare reduction(fun5 : long : omp_out += omp_in) initializer(temp) // expected-error {{only 'omp_priv' or 'omp_orig' variables are allowed in initializer expression}} #pragma omp declare reduction(fun6 : long : omp_out += omp_in) initializer(omp_orig // expected-error {{expected ')'}} expected-note {{to match this '('}} Index: test/OpenMP/openmp_check.cpp =================================================================== --- test/OpenMP/openmp_check.cpp +++ test/OpenMP/openmp_check.cpp @@ -1,15 +1,35 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s + int nested(int a) { #pragma omp parallel ++a; - auto F = [&]() { // expected-error {{expected expression}} expected-error {{expected ';' at end of declaration}} expected-warning {{'auto' type specifier is a C++11 extension}} + auto F = [&]() { +#if __cplusplus <= 199711L + // expected-warning@-2 {{'auto' type specifier is a C++11 extension}} + // expected-error@-3 {{expected expression}} + // expected-error@-4 {{expected ';' at end of declaration}} +#else + // expected-no-diagnostics +#endif + #pragma omp parallel { #pragma omp target ++a; } }; - F(); // expected-error {{C++ requires a type specifier for all declarations}} - return a; // expected-error {{expected unqualified-id}} -}// expected-error {{extraneous closing brace ('}')}} + F(); +#if __cplusplus <= 199711L + // expected-error@-2 {{C++ requires a type specifier for all declarations}} +#endif + return a; +#if __cplusplus <= 199711L + // expected-error@-2 {{expected unqualified-id}} +#endif +} +#if __cplusplus <= 199711L +// expected-error@-2 {{extraneous closing brace ('}')}} +#endif Index: test/SemaCXX/PR9572.cpp =================================================================== --- test/SemaCXX/PR9572.cpp +++ test/SemaCXX/PR9572.cpp @@ -1,15 +1,49 @@ // 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 Base { - virtual ~Base(); // expected-note {{implicitly declared private here}} + virtual ~Base(); +#if __cplusplus <= 199711L + // expected-note@-2 {{implicitly declared private here}} +#else + // expected-note@-4 {{overridden virtual function is here}} +#endif }; -struct Foo : public Base { // expected-error {{base class 'Base' has private destructor}} - const int kBlah = 3; // expected-warning {{is a C++11 extension}} + +struct Foo : public Base { +#if __cplusplus <= 199711L +// expected-error@-2 {{base class 'Base' has private destructor}} +#else +// expected-error@-4 {{deleted function '~Foo' cannot override a non-deleted function}} +// expected-note@-5 {{overridden virtual function is here}} +// expected-note@-6 3 {{destructor of 'Foo' is implicitly deleted because base class 'Base' has an inaccessible destructor}} +#endif + + const int kBlah = 3; +#if __cplusplus <= 199711L + // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} +#endif + Foo(); }; + struct Bar : public Foo { - Bar() { } // expected-note {{implicit destructor for 'Foo' first required here}} +#if __cplusplus >= 201103L +// expected-error@-2 {{non-deleted function '~Bar' cannot override a deleted function}} +#endif + Bar() { } +#if __cplusplus <= 199711L + // expected-note@-2 {{implicit destructor for 'Foo' first required here}} +#else + // expected-error@-4 {{attempt to use a deleted function}} +#endif }; + struct Baz { Foo f; Baz() { } +#if __cplusplus >= 201103L + // expected-error@-2 {{attempt to use a deleted function}} +#endif }; Index: test/SemaCXX/default-assignment-operator.cpp =================================================================== --- test/SemaCXX/default-assignment-operator.cpp +++ test/SemaCXX/default-assignment-operator.cpp @@ -1,16 +1,34 @@ // 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 Base { // expected-error {{cannot define the implicit copy assignment operator for 'Base', because non-static reference member 'ref' cannot use copy assignment operator}} \ - // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}} - int &ref; // expected-note {{declared here}} \ - // expected-note{{reference member 'ref' will never be initialized}} +class Base { // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}} +#if __cplusplus <= 199711L +// expected-error@-2 {{cannot define the implicit copy assignment operator for 'Base', because non-static reference member 'ref' cannot use copy assignment operator}} +#endif + + int &ref; // expected-note{{reference member 'ref' will never be initialized}} +#if __cplusplus <= 199711L + // expected-note@-2 {{declared here}} +#else + // expected-note@-4 2 {{copy assignment operator of 'Base' is implicitly deleted because field 'ref' is of reference type 'int &'}} +#endif }; -class X : Base { // // expected-error {{cannot define the implicit copy assignment operator for 'X', because non-static const member 'cint' cannot use copy assignment operator}} \ -// expected-note{{assignment operator for 'Base' first required here}} +class X : Base { +#if __cplusplus <= 199711L +// expected-note@-2 {{assignment operator for 'Base' first required here}} +// expected-error@-3 {{cannot define the implicit copy assignment operator for 'X', because non-static const member 'cint' cannot use copy assignment operator}} +#else +// expected-note@-5 2 {{copy assignment operator of 'X' is implicitly deleted because base class 'Base' has a deleted copy assignment operator}} +#endif + public: X(); - const int cint; // expected-note {{declared here}} + const int cint; +#if __cplusplus <= 199711L +// expected-note@-2 {{declared here}} +#endif }; struct Y : X { @@ -28,8 +46,17 @@ // Test1 void f(X x, const X cx) { - x = cx; // expected-note{{assignment operator for 'X' first required here}} x = cx; +#if __cplusplus <= 199711L + // expected-note@-2 {{assignment operator for 'X' first required here}} +#else + // expected-error@-4 {{object of type 'X' cannot be assigned because its copy assignment operator is implicitly deleted}} +#endif + + x = cx; +#if __cplusplus >= 201103L + // expected-error@-2 {{object of type 'X' cannot be assigned because its copy assignment operator is implicitly deleted}} +#endif z1 = z2; } @@ -73,36 +100,62 @@ // Test5 -class E1 { // expected-error{{cannot define the implicit copy assignment operator for 'E1', because non-static const member 'a' cannot use copy assignment operator}} +class E1 { +#if __cplusplus <= 199711L +// expected-error@-2 {{cannot define the implicit copy assignment operator for 'E1', because non-static const member 'a' cannot use copy assignment operator}} +#endif public: - const int a; // expected-note{{declared here}} - E1() : a(0) {} + const int a; +#if __cplusplus <= 199711L +// expected-note@-2 {{declared here}} +#else +// expected-note@-4 {{copy assignment operator of 'E1' is implicitly deleted because field 'a' is of const-qualified type 'const int'}} +#endif + E1() : a(0) {} }; E1 e1, e2; void j() { - e1 = e2; // expected-note{{assignment operator for 'E1' first required here}} + e1 = e2; +#if __cplusplus <= 199711L + // expected-note@-2 {{assignment operator for 'E1' first required here}} +#else + // expected-error@-4 {{object of type 'E1' cannot be assigned because its copy assignment operator is implicitly deleted}} +#endif } namespace ProtectedCheck { struct X { protected: - X &operator=(const X&); // expected-note{{declared protected here}} + X &operator=(const X&); +#if __cplusplus <= 199711L + // expected-note@-2 {{declared protected here}} +#endif }; struct Y : public X { }; void f(Y y) { y = y; } - struct Z { // expected-error{{'operator=' is a protected member of 'ProtectedCheck::X'}} + struct Z { +#if __cplusplus <= 199711L + // expected-error@-2 {{'operator=' is a protected member of 'ProtectedCheck::X'}} +#endif X x; +#if __cplusplus >= 201103L + // expected-note@-2 {{copy assignment operator of 'Z' is implicitly deleted because field 'x' has an inaccessible copy assignment operator}} +#endif }; - void f(Z z) { z = z; } // expected-note{{implicit copy assignment operator}} - + void f(Z z) { z = z; } +#if __cplusplus <= 199711L + // expected-note@-2 {{implicit copy assignment operator}} +#else + // expected-error@-4 {{object of type 'ProtectedCheck::Z' cannot be assigned because its copy assignment operator is implicitly deleted}} +#endif } namespace MultiplePaths { Index: test/SemaCXX/default-constructor-initializers.cpp =================================================================== --- test/SemaCXX/default-constructor-initializers.cpp +++ test/SemaCXX/default-constructor-initializers.cpp @@ -1,26 +1,59 @@ // 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 X1 { // has no implicit default constructor X1(int); }; -struct X2 : X1 { // expected-note 2 {{'X2' declared here}} - X2(int); -}; - -struct X3 : public X2 { // expected-error {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}} -}; -X3 x3; // expected-note {{first required here}} +struct X2 : X1 { +#if __cplusplus <= 199711L +// expected-note@-2 2 {{'X2' declared here}} +#endif - -struct X4 { // expected-error {{must explicitly initialize the member 'x2'}} \ - // expected-error {{must explicitly initialize the reference member 'rx2'}} - X2 x2; // expected-note {{member is declared here}} - X2 & rx2; // expected-note {{declared here}} + X2(int); }; -X4 x4; // expected-note {{first required here}} - +struct X3 : public X2 { +#if __cplusplus <= 199711L +// expected-error@-2 {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}} +#else +// expected-note@-4 {{default constructor of 'X3' is implicitly deleted because base class 'X2' has no default constructor}} +#endif +}; + +X3 x3; +#if __cplusplus <= 199711L +// expected-note@-2 {{first required here}} +#else +// expected-error@-4 {{call to implicitly-deleted default constructor of 'X3'}} +#endif + +struct X4 { +#if __cplusplus <= 199711L +// expected-error@-2 {{must explicitly initialize the member 'x2'}} +// expected-error@-3 {{must explicitly initialize the reference member 'rx2'}} +#endif + + X2 x2; +#if __cplusplus <= 199711L + // expected-note@-2 {{member is declared here}} +#else + // expected-note@-4 {{default constructor of 'X4' is implicitly deleted because field 'x2' has no default constructor}} +#endif + + X2 & rx2; +#if __cplusplus <= 199711L + // expected-note@-2 {{declared here}} +#endif +}; + +X4 x4; +#if __cplusplus <= 199711L +// expected-note@-2 {{first required here}} +#else +// expected-error@-4 {{call to implicitly-deleted default constructor of 'X4'}} +#endif struct Y1 { // has no implicit default constructor Y1(int); @@ -43,15 +76,33 @@ // More tests -struct Z1 { // expected-error {{must explicitly initialize the reference member 'z'}} \ - // expected-error {{must explicitly initialize the const member 'c1'}} - int& z; // expected-note {{declared here}} - const int c1; // expected-note {{declared here}} +struct Z1 { +#if __cplusplus <= 199711L +// expected-error@-2 {{must explicitly initialize the reference member 'z'}} +// expected-error@-3 {{must explicitly initialize the const member 'c1'}} +#endif + + int& z; +#if __cplusplus <= 199711L + // expected-note@-2 {{declared here}} +#else + // expected-note@-4 {{default constructor of 'Z1' is implicitly deleted because field 'z' of reference type 'int &' would not be initialized}} +#endif + + const int c1; +#if __cplusplus <= 199711L + // expected-note@-2 {{declared here}} +#endif volatile int v1; }; // Test default initialization which *requires* a constructor call for non-POD. -Z1 z1; // expected-note {{first required here}} +Z1 z1; +#if __cplusplus <= 199711L +// expected-note@-2 {{first required here}} +#else +// expected-error@-4 {{call to implicitly-deleted default constructor of 'Z1'}} +#endif // Ensure that value initialization doesn't use trivial implicit constructors. namespace PR7948 { Index: test/SemaCXX/format-strings.cpp =================================================================== --- test/SemaCXX/format-strings.cpp +++ test/SemaCXX/format-strings.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++11 %s #include @@ -9,9 +11,13 @@ } void f(char **sp, float *fp) { - scanf("%as", sp); // expected-warning{{'a' length modifier is not supported by ISO C}} + scanf("%as", sp); +#if __cplusplus <= 199711L + // expected-warning@-2 {{'a' length modifier is not supported by ISO C}} +#else + // expected-warning@-4 {{format specifies type 'float *' but the argument has type 'char **'}} +#endif - // TODO: Warn that the 'a' conversion specifier is a C++11 feature. printf("%a", 1.0); scanf("%afoobar", fp); } @@ -46,11 +52,19 @@ // Test handling __null for format string literal checking. extern "C" { int test_null_format(const char *format, ...) __attribute__((__format__ (__printf__, 1, 2))); +#if __cplusplus >= 201103L + // expected-note@-2 {{candidate function not viable: no known conversion from 'bool' to 'const char *' for 1st argument}} +#endif } void rdar8269537(const char *f) { - test_null_format(false); // expected-warning {{null from a constant boolean}} + test_null_format(false); +#if __cplusplus <= 199711L + // expected-warning@-2 {{null from a constant boolean}} +#else + // expected-error@-4 {{no matching function for call to 'test_null_format'}} +#endif test_null_format(0); // no-warning test_null_format(__null); // no-warning test_null_format(f); // expected-warning {{not a string literal}} Index: test/SemaCXX/printf-cstr.cpp =================================================================== --- test/SemaCXX/printf-cstr.cpp +++ test/SemaCXX/printf-cstr.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -Wformat -verify %s -Wno-error=non-pod-varargs +// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++98 %s -Wno-error=non-pod-varargs +// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++11 %s -Wno-error=non-pod-varargs #include @@ -31,12 +33,39 @@ int n = 10; printf("%d: %s\n", n, hcs.c_str()); - printf("%d: %s\n", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}} - printf("%d: %s\n", n, hncs); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}} - sprintf(str, "%d: %s", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}} - - printf(formatString, hcs, hncs); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} expected-warning{{cannot pass object of non-POD type 'HasNoCStr' through variadic function}} - printf(extstr, hcs, n); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} + printf("%d: %s\n", n, hcs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} + // expected-note@-3 {{did you mean to call the c_str() method?}} +#else + // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}} +#endif + + printf("%d: %s\n", n, hncs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}} +#else + // expected-warning@-4 {{format specifies type 'char *' but the argument has type 'HasNoCStr'}} +#endif + + sprintf(str, "%d: %s", n, hcs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} + // expected-note@-3 {{did you mean to call the c_str() method?}} +#else + // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}} +#endif + + printf(formatString, hcs, hncs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass object of non-POD type 'HasCStr' through variadic function}} + // expected-warning@-3 {{cannot pass object of non-POD type 'HasNoCStr' through variadic function}} +#endif + + printf(extstr, hcs, n); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass object of non-POD type 'HasCStr' through variadic function}} +#endif } struct Printf { @@ -49,5 +78,11 @@ const char str[] = "test"; HasCStr hcs(str); Printf p("%s %d %s", str, 10, 10); // expected-warning {{format specifies type 'char *' but the argument has type 'int'}} - Printf q("%s %d", hcs, 10); // expected-warning {{cannot pass non-POD object of type 'HasCStr' to variadic constructor; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}} + Printf q("%s %d", hcs, 10); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic constructor; expected type from format string was 'char *'}} + // expected-note@-3 {{did you mean to call the c_str() method?}} +#else + // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}} +#endif } Index: test/SemaCXX/warn-thread-safety-parsing.cpp =================================================================== --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE __attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,10 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ - // expected-error {{invalid use of member 'mu' in static member function}} + static void foo5() EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif template void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1461,15 +1465,21 @@ mutable Mutex mu; int a GUARDED_BY(mu); - static int si GUARDED_BY(mu); // \ - // expected-error {{invalid use of non-static data member 'mu'}} + static int si GUARDED_BY(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif - static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ - // expected-error {{invalid use of member 'mu' in static member function}} + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif friend FooStream& operator<<(FooStream& s, const Foo& f) - EXCLUSIVE_LOCKS_REQUIRED(mu); // \ - // expected-error {{invalid use of non-static data member 'mu'}} + EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif };