r266387 - Lit C++11 Compatibility Patch #8
Charles Li via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 14 16:47:07 PDT 2016
Author: lcharles
Date: Thu Apr 14 18:47:07 2016
New Revision: 266387
URL: http://llvm.org/viewvc/llvm-project?rev=266387&view=rev
Log:
Lit C++11 Compatibility Patch #8
24 tests have been updated for C++11 compatibility.
Modified:
cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
cfe/trunk/test/CXX/class/class.friend/p1.cpp
cfe/trunk/test/CXX/class/class.friend/p2.cpp
cfe/trunk/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
cfe/trunk/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp
cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp
cfe/trunk/test/CXX/temp/temp.spec/no-body.cpp
cfe/trunk/test/CodeGenCXX/const-init.cpp
cfe/trunk/test/Parser/cxx-class.cpp
cfe/trunk/test/Parser/cxx-decl.cpp
cfe/trunk/test/Parser/cxx-friend.cpp
cfe/trunk/test/SemaCXX/anonymous-struct.cpp
cfe/trunk/test/SemaCXX/class.cpp
cfe/trunk/test/SemaCXX/conversion-function.cpp
cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
cfe/trunk/test/SemaCXX/exceptions.cpp
cfe/trunk/test/SemaCXX/qual-id-test.cpp
cfe/trunk/test/SemaCXX/unused.cpp
cfe/trunk/test/SemaCXX/warn-unused-value.cpp
cfe/trunk/test/SemaTemplate/member-access-expr.cpp
cfe/trunk/test/SemaTemplate/recovery-crash.cpp
cfe/trunk/test/SemaTemplate/temp_arg_type.cpp
Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp (original)
+++ cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++11 %s
// C++98 [basic.lookup.classref]p1:
// In a class member access expression (5.2.5), if the . or -> token is
@@ -21,10 +23,16 @@
// From PR 7247
template<typename T>
-struct set{}; // expected-note{{lookup from the current scope refers here}}
+struct set{};
+#if __cplusplus <= 199711L
+// expected-note at -2 {{lookup from the current scope refers here}}
+#endif
struct Value {
template<typename T>
- void set(T value) {} // expected-note{{lookup in the object type 'Value' refers here}}
+ void set(T value) {}
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{lookup in the object type 'Value' refers here}}
+#endif
void resolves_to_same() {
Value v;
@@ -36,7 +44,10 @@ void resolves_to_different() {
Value v;
// The fact that the next line is a warning rather than an error is an
// extension.
- v.set<double>(3.2); // expected-warning{{lookup of 'set' in member access expression is ambiguous; using member of 'Value'}}
+ v.set<double>(3.2);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{lookup of 'set' in member access expression is ambiguous; using member of 'Value'}}
+#endif
}
{
int set; // Non-template.
Modified: cfe/trunk/test/CXX/class/class.friend/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.friend/p1.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/class.friend/p1.cpp (original)
+++ cfe/trunk/test/CXX/class/class.friend/p1.cpp Thu Apr 14 18:47:07 2016
@@ -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 Outer {
struct Inner {
@@ -41,7 +43,10 @@ class A {
UndeclaredSoFar x; // expected-error {{unknown type name 'UndeclaredSoFar'}}
void a_member();
- friend void A::a_member(); // expected-error {{friends cannot be members of the declaring class}}
+ friend void A::a_member();
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{friends cannot be members of the declaring class}}
+#endif
friend void a_member(); // okay (because we ignore class scopes when looking up friends)
friend class A::AInner; // this is okay as an extension
friend class AInner; // okay, refers to ::AInner
Modified: cfe/trunk/test/CXX/class/class.friend/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.friend/p2.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/class.friend/p2.cpp (original)
+++ cfe/trunk/test/CXX/class/class.friend/p2.cpp Thu Apr 14 18:47:07 2016
@@ -1,10 +1,18 @@
// 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 B0;
class A {
friend class B {}; // expected-error {{cannot define a type in a friend declaration}}
- friend int; // expected-warning {{non-class friend type 'int' is a C++11 extension}}
- friend B0; // expected-warning {{specify 'struct' to befriend 'B0'}}
+ friend int;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{non-class friend type 'int' is a C++11 extension}}
+#endif
+ friend B0;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{unelaborated friend declaration is a C++11 extension; specify 'struct' to befriend 'B0'}}
+#endif
friend class C; // okay
};
Modified: cfe/trunk/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/stmt.stmt/stmt.dcl/p3.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/stmt.stmt/stmt.dcl/p3.cpp (original)
+++ cfe/trunk/test/CXX/stmt.stmt/stmt.dcl/p3.cpp Thu Apr 14 18:47:07 2016
@@ -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
// PR10034
struct X {};
@@ -40,8 +42,16 @@ struct Z {
};
void test_Z() {
- goto end; // expected-error{{cannot jump from this goto statement to its label}}
- Z z; // expected-note{{jump bypasses initialization of non-POD variable}}
+ goto end;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{cannot jump from this goto statement to its label}}
+#endif
+
+ Z z;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{jump bypasses initialization of non-POD variable}}
+#endif
+
end:
return;
}
Modified: cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu -std=c++11 %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -triple=x86_64-linux-gnu %s -DCPP11ONLY
// C++11 [temp.arg.nontype]p1:
@@ -31,43 +33,103 @@ namespace non_type_tmpl_param {
// if the corresopnding template-parameter is a reference; or
namespace addr_of_obj_or_func {
template <int* p> struct X0 { }; // expected-note 5{{here}}
+#if __cplusplus >= 201103L
+ // expected-note at -2 2{{template parameter is declared here}}
+#endif
+
template <int (*fp)(int)> struct X1 { };
template <int &p> struct X2 { }; // expected-note 4{{here}}
template <const int &p> struct X2k { }; // expected-note {{here}}
template <int (&fp)(int)> struct X3 { }; // expected-note 4{{here}}
int i = 42;
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{declared here}}
+#endif
+
int iarr[10];
int f(int i);
- const int ki = 9; // expected-note 5{{here}}
- __thread int ti = 100; // expected-note 2{{here}}
- static int f_internal(int); // expected-note 4{{here}}
+ const int ki = 9;
+#if __cplusplus <= 199711L
+ // expected-note at -2 5{{non-type template argument refers to object here}}
+#endif
+
+ __thread int ti = 100; // expected-note {{here}}
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{here}}
+#endif
+
+ static int f_internal(int);
+#if __cplusplus <= 199711L
+ // expected-note at -2 4{{non-type template argument refers to function here}}
+#endif
+
template <typename T> T f_tmpl(T t);
struct S { union { int NonStaticMember; }; };
void test() {
- X0<i> x0a; // expected-error {{must have its address taken}}
+ X0<i> x0a;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{non-type template argument for template parameter of pointer type 'int *' must have its address taken}}
+#else
+ // expected-error at -4 {{non-type template argument of type 'int' is not a constant expression}}
+ // expected-note at -5 {{read of non-const variable 'i' is not allowed in a constant expression}}
+#endif
X0<&i> x0a_addr;
X0<iarr> x0b;
X0<&iarr> x0b_addr; // expected-error {{cannot be converted to a value of type 'int *'}}
- X0<ki> x0c; // expected-error {{must have its address taken}} expected-warning {{internal linkage is a C++11 extension}}
- X0<&ki> x0c_addr; // expected-error {{cannot be converted to a value of type 'int *'}} expected-warning {{internal linkage is a C++11 extension}}
- X0<&ti> x0d_addr; // expected-error {{refers to thread-local object}}
+ X0<ki> x0c; // expected-error {{must have its address taken}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
+ X0<&ki> x0c_addr; // expected-error {{cannot be converted to a value of type 'int *'}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
+ X0<&ti> x0d_addr;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{non-type template argument refers to thread-local object}}
+#else
+ // expected-error at -4 {{non-type template argument of type 'int *' is not a constant expression}}
+#endif
+
X1<f> x1a;
X1<&f> x1a_addr;
X1<f_tmpl> x1b;
X1<&f_tmpl> x1b_addr;
X1<f_tmpl<int> > x1c;
X1<&f_tmpl<int> > x1c_addr;
- X1<f_internal> x1d; // expected-warning {{internal linkage is a C++11 extension}}
- X1<&f_internal> x1d_addr; // expected-warning {{internal linkage is a C++11 extension}}
+ X1<f_internal> x1d;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
+ X1<&f_internal> x1d_addr;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
X2<i> x2a;
X2<&i> x2a_addr; // expected-error {{address taken}}
X2<iarr> x2b; // expected-error {{cannot bind to template argument of type 'int [10]'}}
X2<&iarr> x2b_addr; // expected-error {{address taken}}
- X2<ki> x2c; // expected-error {{ignores qualifiers}} expected-warning {{internal linkage is a C++11 extension}}
- X2k<ki> x2kc; // expected-warning {{internal linkage is a C++11 extension}}
- X2k<&ki> x2kc_addr; // expected-error {{address taken}} expected-warning {{internal linkage is a C++11 extension}}
+ X2<ki> x2c; // expected-error {{ignores qualifiers}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
+ X2k<ki> x2kc;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
+ X2k<&ki> x2kc_addr; // expected-error {{address taken}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
X2<ti> x2d_addr; // expected-error {{refers to thread-local object}}
X3<f> x3a;
X3<&f> x3a_addr; // expected-error {{address taken}}
@@ -75,11 +137,31 @@ namespace addr_of_obj_or_func {
X3<&f_tmpl> x3b_addr; // expected-error {{address taken}}
X3<f_tmpl<int> > x3c;
X3<&f_tmpl<int> > x3c_addr; // expected-error {{address taken}}
- X3<f_internal> x3d; // expected-warning {{internal linkage is a C++11 extension}}
- X3<&f_internal> x3d_addr; // expected-error {{address taken}} expected-warning {{internal linkage is a C++11 extension}}
+ X3<f_internal> x3d;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
+ X3<&f_internal> x3d_addr; // expected-error {{address taken}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{internal linkage is a C++11 extension}}
+#endif
+
+ int n;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{non-type template argument refers to object here}}
+#else
+ // expected-note at -4 {{declared here}}
+#endif
+
+ X0<&n> x0_no_linkage;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{non-type template argument refers to object 'n' that does not have linkage}}
+#else
+ // expected-error at -4 {{non-type template argument of type 'int *' is not a constant expression}}
+ // expected-note at -5 {{pointer to 'n' is not a constant expression}}
+#endif
- int n; // expected-note {{here}}
- X0<&n> x0_no_linkage; // expected-error {{non-type template argument refers to object 'n' that does not have linkage}}
struct Local { static int f() {} }; // expected-note {{here}}
X1<&Local::f> x1_no_linkage; // expected-error {{non-type template argument refers to function 'f' that does not have linkage}}
X0<&S::NonStaticMember> x0_non_static; // expected-error {{non-static data member}}
@@ -96,7 +178,17 @@ namespace bad_args {
int i = 42;
X0<&i + 2> x0a; // expected-error{{non-type template argument does not refer to any declaration}}
int* iptr = &i;
- X0<iptr> x0b; // expected-error{{non-type template argument for template parameter of pointer type 'int *' must have its address taken}}
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{declared here}}
+#endif
+
+ X0<iptr> x0b;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{non-type template argument for template parameter of pointer type 'int *' must have its address taken}}
+#else
+ // expected-error at -4 {{non-type template argument of type 'int *' is not a constant expression}}
+ // expected-note at -5 {{read of non-constexpr variable 'iptr' is not allowed in a constant expression}}
+#endif
}
#endif // CPP11ONLY
@@ -108,4 +200,4 @@ int f();
}
#endif // CPP11ONLY
-}
\ No newline at end of file
+}
Modified: cfe/trunk/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp Thu Apr 14 18:47:07 2016
@@ -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
+
template<class T> struct A {
static T t; // expected-error{{static data member instantiated with function type 'int ()'}}
};
@@ -11,10 +14,17 @@ template<typename T> struct B {
B<function> b; // expected-note{{instantiation of}}
template <typename T> int f0(void *, const T&); // expected-note{{candidate template ignored: substitution failure}}
-enum {e}; // expected-note{{unnamed type used in template argument was declared here}}
+enum {e};
+#if __cplusplus <= 199711L
+// expected-note at -2 {{unnamed type used in template argument was declared here}}
+#endif
void test_f0(int n) {
- int i = f0(0, e); // expected-warning{{template argument uses unnamed type}}
+ int i = f0(0, e);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses unnamed type}}
+#endif
+
int vla[n];
f0(0, vla); // expected-error{{no matching function for call to 'f0'}}
}
@@ -23,20 +33,50 @@ namespace N0 {
template <typename R, typename A1> void f0(R (*)(A1));
template <typename T> int f1(T);
template <typename T, typename U> int f1(T, U);
- enum {e1}; // expected-note 2{{unnamed type used in template argument was declared here}}
- enum {e2}; // expected-note 2{{unnamed type used in template argument was declared here}}
- enum {e3}; // expected-note{{unnamed type used in template argument was declared here}}
+ enum {e1};
+#if __cplusplus <= 199711L
+ // expected-note at -2 2{{unnamed type used in template argument was declared here}}
+#endif
+
+ enum {e2};
+#if __cplusplus <= 199711L
+ // expected-note at -2 2{{unnamed type used in template argument was declared here}}
+#endif
+
+ enum {e3};
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{unnamed type used in template argument was declared here}}
+#endif
template<typename T> struct X;
template<typename T> struct X<T*> { };
void f() {
- f0( // expected-warning{{template argument uses unnamed type}}
- &f1<__typeof__(e1)>); // expected-warning{{template argument uses unnamed type}}
- int (*fp1)(int, __typeof__(e2)) = f1; // expected-warning{{template argument uses unnamed type}}
- f1(e2); // expected-warning{{template argument uses unnamed type}}
+ f0(
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses unnamed type}}
+#endif
+
+ &f1<__typeof__(e1)>);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses unnamed type}}
+#endif
+
+ int (*fp1)(int, __typeof__(e2)) = f1;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses unnamed type}}
+#endif
+
+ f1(e2);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses unnamed type}}
+#endif
+
f1(e2);
- X<__typeof__(e3)*> x; // expected-warning{{template argument uses unnamed type}}
+ X<__typeof__(e3)*> x;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses unnamed type}}
+#endif
}
}
Modified: cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp Thu Apr 14 18:47:07 2016
@@ -1,9 +1,22 @@
// 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 <int> int f(int); // expected-note 2{{candidate}}
-template <signed char> int f(int); // expected-note 2{{candidate}}
-int i1 = f<1>(0); // expected-error{{ambiguous}}
-int i2 = f<1000>(0); // expected-error{{ambiguous}}
+template <int> int f(int); // expected-note {{candidate function}}
+#if __cplusplus <= 199711L
+// expected-note at -2 {{candidate function}}
+#endif
+
+template <signed char> int f(int); // expected-note {{candidate function}}
+#if __cplusplus <= 199711L
+// expected-note at -2 {{candidate function}}
+#endif
+
+int i1 = f<1>(0); // expected-error{{call to 'f' is ambiguous}}
+int i2 = f<1000>(0);
+#if __cplusplus <= 199711L
+// expected-error at -2{{call to 'f' is ambiguous}}
+#endif
namespace PR6707 {
template<typename T, T Value>
Modified: cfe/trunk/test/CXX/temp/temp.spec/no-body.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/no-body.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/no-body.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/no-body.cpp Thu Apr 14 18:47:07 2016
@@ -1,17 +1,44 @@
// 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
// RUN: cp %s %t
// RUN: not %clang_cc1 -x c++ -fixit %t -DFIXING
// RUN: %clang_cc1 -x c++ %t -DFIXING
template<typename T> void f(T) { }
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{explicit instantiation refers here}}
+#endif
+
template<typename T> void g(T) { }
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{explicit instantiation refers here}}
+#endif
+
template<typename T> struct x { };
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{explicit instantiation refers here}}
+#endif
+
template<typename T> struct y { }; // expected-note {{declared here}}
-namespace good {
+namespace good { // Only good in C++98/03
+#ifndef FIXING
template void f<int>(int);
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{explicit instantiation of 'f' must occur at global scope}}
+#endif
+
template void g(int);
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{explicit instantiation of 'g' must occur at global scope}}
+#endif
+
template struct x<int>;
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{explicit instantiation of 'x' must occur at global scope}}
+#endif
+#endif
}
namespace unsupported {
Modified: cfe/trunk/test/CodeGenCXX/const-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/const-init.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/const-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/const-init.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -std=c++98 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -std=c++11 -o - %s | FileCheck %s
// CHECK: @a = global i32 10
int a = 10;
@@ -27,8 +29,13 @@ C g0 = { C::e1 };
namespace test2 {
struct A {
+#if __cplusplus <= 199711L
static const double d = 1.0;
static const float f = d / 2;
+#else
+ static constexpr double d = 1.0;
+ static constexpr float f = d / 2;
+#endif
static int g();
} a;
Modified: cfe/trunk/test/Parser/cxx-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-class.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-class.cpp (original)
+++ cfe/trunk/test/Parser/cxx-class.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++11 %s
+
class C;
class C {
public:
@@ -69,11 +72,30 @@ public; // expected-error{{expected ':'}
};
class F {
- int F1 { return 1; } // expected-error{{function definition does not declare parameters}}
- void F2 {} // expected-error{{function definition does not declare parameters}}
+ int F1 { return 1; }
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{function definition does not declare parameters}}
+#else
+ // expected-error at -4 {{expected expression}}
+ // expected-error at -5 {{expected}}
+ // expected-note at -6 {{to match this '{'}}
+ // expected-error at -7 {{expected ';' after class}}
+#endif
+
+ void F2 {}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{function definition does not declare parameters}}
+#else
+ // expected-error at -4 {{variable has incomplete type 'void'}}
+ // expected-error at -5 {{expected ';' after top level declarator}}
+#endif
+
typedef int F3() { return 0; } // expected-error{{function definition declared 'typedef'}}
typedef void F4() {} // expected-error{{function definition declared 'typedef'}}
};
+#if __cplusplus >= 201103L
+// expected-error at -2 {{extraneous closing brace}}
+#endif
namespace ctor_error {
class Foo {};
@@ -203,14 +225,38 @@ namespace BadFriend {
}
class PR20760_a {
- int a = ); // expected-warning {{extension}} expected-error {{expected expression}}
- int b = }; // expected-warning {{extension}} expected-error {{expected expression}}
- int c = ]; // expected-warning {{extension}} expected-error {{expected expression}}
+ int a = ); // expected-error {{expected expression}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int b = }; // expected-error {{expected expression}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int c = ]; // expected-error {{expected expression}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
};
class PR20760_b {
- int d = d); // expected-warning {{extension}} expected-error {{expected ';'}}
- int e = d]; // expected-warning {{extension}} expected-error {{expected ';'}}
- int f = d // expected-warning {{extension}} expected-error {{expected ';'}}
+ int d = d); // expected-error {{expected ';'}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int e = d]; // expected-error {{expected ';'}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int f = d // expected-error {{expected ';'}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
};
namespace PR20887 {
Modified: cfe/trunk/test/Parser/cxx-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-decl.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx-decl.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic-errors -fcxx-exceptions -fexceptions %s
+// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic-errors -fcxx-exceptions -fexceptions -std=c++98 %s
+// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic-errors -fcxx-exceptions -fexceptions -std=c++11 %s
const char const *x10; // expected-error {{duplicate 'const' declaration specifier}}
@@ -46,7 +48,10 @@ class asm_class_test {
void foo() __asm__("baz");
};
-enum { fooenum = 1, }; // expected-error {{commas at the end of enumerator lists are a C++11 extension}}
+enum { fooenum = 1, };
+#if __cplusplus <= 199711L
+// expected-error at -2 {{commas at the end of enumerator lists are a C++11 extension}}
+#endif
struct a {
int Type : fooenum;
@@ -81,7 +86,11 @@ namespace Commas {
(global5),
*global6,
&global7 = global1,
- &&global8 = static_cast<int&&>(global1), // expected-error 2{{rvalue reference}}
+ &&global8 = static_cast<int&&>(global1),
+#if __cplusplus <= 199711L
+ // expected-error at -2 2{{rvalue references are a C++11 extension}}
+#endif
+
S::a,
global9,
global10 = 0,
@@ -185,7 +194,13 @@ namespace PR15017 {
}
// Ensure we produce at least some diagnostic for attributes in C++98.
-[[]] struct S; // expected-error 2{{}}
+[[]] struct S;
+#if __cplusplus <= 199711L
+// expected-error at -2 {{expected expression}}
+// expected-error at -3 {{expected unqualified-id}}
+#else
+// expected-error at -5 {{an attribute list cannot appear here}}
+#endif
namespace test7 {
struct Foo {
@@ -212,14 +227,20 @@ namespace PR5066 {
template<typename T> struct X {};
X<int N> x; // expected-error {{type-id cannot have a name}}
- using T = int (*T)(); // expected-error {{type-id cannot have a name}} expected-error {{C++11}}
+ using T = int (*T)(); // expected-error {{type-id cannot have a name}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{alias declarations are a C++11 extensio}}
+#endif
+
}
namespace PR17255 {
void foo() {
- typename A::template B<>; // expected-error {{use of undeclared identifier 'A'}} \
- // expected-error {{expected a qualified name after 'typename'}} \
- // expected-error {{'template' keyword outside of a template}}
+ typename A::template B<>; // expected-error {{use of undeclared identifier 'A'}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{'template' keyword outside of a template}}
+#endif
+ // expected-error at -4 {{expected a qualified name after 'typename'}}
}
}
@@ -236,12 +257,25 @@ namespace DuplicateFriend {
struct A {
friend void friend f(); // expected-warning {{duplicate 'friend' declaration specifier}}
friend struct B friend; // expected-warning {{duplicate 'friend' declaration specifier}}
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{'friend' must appear first in a non-function declaration}}
+#endif
};
}
// PR8380
extern "" // expected-error {{unknown linkage language}}
-test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \
- // expected-error {{expected ';' after top level declarator}}
+test6a { ;// expected-error {{C++ requires a type specifier for all declarations}}
+#if __cplusplus <= 199711L
+// expected-error at -2 {{expected ';' after top level declarator}}
+#else
+// expected-error at -4 {{expected expression}}
+// expected-note at -5 {{to match this}}
+#endif
int test6b;
+#if __cplusplus >= 201103L
+// expected-error at +3 {{expected}}
+// expected-error at -3 {{expected ';' after top level declarator}}
+#endif
+
Modified: cfe/trunk/test/Parser/cxx-friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-friend.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-friend.cpp (original)
+++ cfe/trunk/test/Parser/cxx-friend.cpp Thu Apr 14 18:47:07 2016
@@ -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 C {
friend class D;
@@ -21,9 +23,20 @@ class B {
// 'A' here should refer to the declaration above.
friend class A;
- friend C; // expected-warning {{specify 'class' to befriend}}
- friend U; // expected-warning {{specify 'union' to befriend}}
- friend int; // expected-warning {{non-class friend type 'int'}}
+ friend C;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'C'}}
+#endif
+
+ friend U;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{unelaborated friend declaration is a C++11 extension; specify 'union' to befriend 'U'}}
+#endif
+
+ friend int;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{non-class friend type 'int' is a C++11 extension}}
+#endif
friend void myfunc();
Modified: cfe/trunk/test/SemaCXX/anonymous-struct.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/anonymous-struct.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/anonymous-struct.cpp (original)
+++ cfe/trunk/test/SemaCXX/anonymous-struct.cpp Thu Apr 14 18:47:07 2016
@@ -1,7 +1,12 @@
// 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 S {
- S(); // expected-note {{because type 'S' has a user-provided default constructor}}
+ S();
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{because type 'S' has a user-provided default constructor}}
+#endif
};
struct { // expected-error {{anonymous structs and classes must be class members}}
@@ -9,15 +14,25 @@ struct { // expected-error {{anonymous s
struct E {
struct {
- S x; // expected-error {{anonymous struct member 'x' has a non-trivial constructor}}
+ S x;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{anonymous struct member 'x' has a non-trivial constructor}}
+#endif
};
static struct {
};
};
template <class T> void foo(T);
-typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}} expected-note {{declared here}}
+typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}}
+#if __cplusplus <= 199711L
+// expected-note at -2 {{declared here}}
+#endif
+
void test() {
- foo(this); // expected-warning {{template argument uses unnamed type}}
+ foo(this);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses unnamed type}}
+#endif
}
} A; // expected-error {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}}
Modified: cfe/trunk/test/SemaCXX/class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/class.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/class.cpp (original)
+++ cfe/trunk/test/SemaCXX/class.cpp Thu Apr 14 18:47:07 2016
@@ -1,7 +1,12 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s
class C {
public:
- auto int errx; // expected-error {{storage class specified for a member declaration}} expected-warning {{'auto' storage class specifier is redundant}}
+ auto int errx; // expected-error {{storage class specified for a member declaration}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{'auto' storage class specifier is redundant}}
+#else
+ // expected-warning at -4 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
+#endif
register int erry; // expected-error {{storage class specified for a member declaration}}
extern int errz; // expected-error {{storage class specified for a member declaration}}
@@ -36,12 +41,18 @@ public:
enum E1 { en1, en2 };
- int i = 0; // expected-warning {{in-class initialization of non-static data member is a C++11 extension}}
+ int i = 0;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
static int si = 0; // expected-error {{non-const static data member must be initialized out of line}}
static const NestedC ci = 0; // expected-error {{static data member of type 'const C::NestedC' must be initialized out of line}}
static const int nci = vs; // expected-error {{in-class initializer for static data member is not a constant expression}}
static const int vi = 0;
static const volatile int cvi = 0; // ok, illegal in C++11
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{static const volatile data member must be initialized out of line}}
+#endif
static const E evi = 0;
void m() {
@@ -169,10 +180,18 @@ namespace rdar8066414 {
namespace rdar8367341 {
float foo();
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{declared here}}
+#endif
struct A {
+#if __cplusplus <= 199711L
static const float x = 5.0f; // expected-warning {{in-class initializer for static data member of type 'const float' is a GNU extension}}
static const float y = foo(); // expected-warning {{in-class initializer for static data member of type 'const float' is a GNU extension}} expected-error {{in-class initializer for static data member is not a constant expression}}
+#else
+ static constexpr float x = 5.0f;
+ static constexpr float y = foo(); // expected-error {{constexpr variable 'y' must be initialized by a constant expression}} expected-note {{non-constexpr function 'foo' cannot be used in a constant expression}}
+#endif
};
}
Modified: cfe/trunk/test/SemaCXX/conversion-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion-function.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/conversion-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/conversion-function.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,7 @@
// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -Wbind-to-temporary-copy -verify %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -Wbind-to-temporary-copy -verify -std=c++98 %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -Wbind-to-temporary-copy -verify -std=c++11 %s
+
class X {
public:
operator bool();
@@ -133,7 +136,12 @@ private:
A1 f() {
// FIXME: redundant diagnostics!
- return "Hello"; // expected-error {{calling a private constructor}} expected-warning {{an accessible copy constructor}}
+ return "Hello"; // expected-error {{calling a private constructor}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{an accessible copy constructor}}
+#else
+ // expected-warning at -4 {{copying parameter of type 'A1' when binding a reference to a temporary would invoke an inaccessible constructor in C++98}}
+#endif
}
namespace source_locations {
@@ -175,7 +183,13 @@ namespace crazy_declarators {
(&operator bool())(); // expected-error {{use a typedef to declare a conversion to 'bool (&)()'}}
*operator int(); // expected-error {{put the complete type after 'operator'}}
// No suggestion of using a typedef here; that's not possible.
- template<typename T> (&operator T())(); // expected-error-re {{cannot specify any part of a return type in the declaration of a conversion function{{$}}}}
+ template<typename T> (&operator T())();
+#if __cplusplus <= 199711L
+ // expected-error-re at -2 {{cannot specify any part of a return type in the declaration of a conversion function{{$}}}}
+#else
+ // expected-error-re at -4 {{cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'T (&)()'{{$}}}}
+#endif
+
};
}
@@ -193,6 +207,10 @@ namespace smart_ptr {
};
struct X { // expected-note{{candidate constructor (the implicit copy constructor) not}}
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{candidate constructor (the implicit move constructor) not}}
+#endif
+
explicit X(Y);
};
@@ -215,7 +233,12 @@ struct Other {
};
void test_any() {
- Any any = Other(); // expected-error{{cannot pass object of non-POD type 'Other' through variadic constructor; call will abort at runtime}}
+ Any any = Other();
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{cannot pass object of non-POD type 'Other' through variadic constructor; call will abort at runtime}}
+#else
+ // expected-error at -4 {{cannot pass object of non-trivial type 'Other' through variadic constructor; call will abort at runtime}}
+#endif
}
namespace PR7055 {
Modified: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only %s -Wno-c++11-extensions -Wno-c++1y-extensions -DPRECXX11
+// RUN: %clang_cc1 -std=c++98 -verify -fsyntax-only %s -Wno-c++11-extensions -Wno-c++1y-extensions -DPRECXX11
// RUN: %clang_cc1 -std=c++11 -verify -fsyntax-only -Wno-c++1y-extensions %s
// RUN: %clang_cc1 -std=c++1y -verify -fsyntax-only %s -DCPP1Y
Modified: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only -Wno-c++11-extensions -Wno-c++1y-extensions %s -DPRECXX11
+// RUN: %clang_cc1 -std=c++98 -verify -fsyntax-only -Wno-c++11-extensions -Wno-c++1y-extensions %s -DPRECXX11
// RUN: %clang_cc1 -std=c++11 -verify -fsyntax-only -Wno-c++1y-extensions %s
// RUN: %clang_cc1 -std=c++1y -verify -fsyntax-only %s
Modified: cfe/trunk/test/SemaCXX/exceptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/exceptions.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/exceptions.cpp (original)
+++ cfe/trunk/test/SemaCXX/exceptions.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
struct A; // expected-note 4 {{forward declaration of 'A'}}
@@ -135,16 +137,29 @@ namespace Decay {
void f() throw (int*, int());
template<typename T> struct C {
- void f() throw (T); // expected-error {{pointer to incomplete type 'Decay::E' is not allowed in exception specification}}
+ void f() throw (T);
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{pointer to incomplete type 'Decay::E' is not allowed in exception specification}}
+#endif
};
struct D {
C<D[10]> c;
};
- struct E; // expected-note {{forward declaration}}
- C<E[10]> e; // expected-note {{in instantiation of}}
+ struct E;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{forward declaration of 'Decay::E'}}
+#endif
+
+ C<E[10]> e;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{in instantiation of template class 'Decay::C<Decay::E [10]>' requested here}}
+#endif
}
-void rval_ref() throw (int &&); // expected-error {{rvalue reference type 'int &&' is not allowed in exception specification}} expected-warning {{C++11}}
+void rval_ref() throw (int &&); // expected-error {{rvalue reference type 'int &&' is not allowed in exception specification}}
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{rvalue references are a C++11 extension}}
+#endif
namespace HandlerInversion {
struct B {};
Modified: cfe/trunk/test/SemaCXX/qual-id-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/qual-id-test.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/qual-id-test.cpp (original)
+++ cfe/trunk/test/SemaCXX/qual-id-test.cpp Thu Apr 14 18:47:07 2016
@@ -1,9 +1,15 @@
// 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
+
namespace A
{
namespace B
{
- struct base // expected-note{{object type}}
+ struct base
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{lookup in the object type 'A::sub' refers here}}
+#endif
{
void x() {}
void y() {}
@@ -85,8 +91,14 @@ namespace C
void fun4a() {
A::sub *a;
- typedef A::member base; // expected-note{{current scope}}
- a->base::x(); // expected-error{{ambiguous}}
+ typedef A::member base;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{lookup from the current scope refers here}}
+#endif
+ a->base::x();
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{lookup of 'base' in member access expression is ambiguous}}
+#endif
}
void fun4b() {
Modified: cfe/trunk/test/SemaCXX/unused.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/unused.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/unused.cpp (original)
+++ cfe/trunk/test/SemaCXX/unused.cpp Thu Apr 14 18:47:07 2016
@@ -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
// PR4103 : Make sure we don't get a bogus unused expression warning
namespace PR4103 {
@@ -28,8 +30,14 @@ namespace PR4103 {
namespace derefvolatile {
void f(volatile char* x) {
- *x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}}
- (void)*x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}}
+ *x;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{expression result unused; assign into a variable to force a volatile load}}
+#endif
+ (void)*x;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{expression result unused; assign into a variable to force a volatile load}}
+#endif
volatile char y = 10;
(void)y; // don't warn here, because it's a common pattern.
}
Modified: cfe/trunk/test/SemaCXX/warn-unused-value.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unused-value.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-unused-value.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-unused-value.cpp Thu Apr 14 18:47:07 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -std=c++11 %s
// PR4806
namespace test0 {
@@ -12,7 +14,10 @@ namespace test0 {
// pointer to volatile has side effect (thus no warning)
Box* box = new Box;
box->i; // expected-warning {{expression result unused}}
- box->j; // expected-warning {{expression result unused}}
+ box->j;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{expression result unused}}
+#endif
}
}
Modified: cfe/trunk/test/SemaTemplate/member-access-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/member-access-expr.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/member-access-expr.cpp (original)
+++ cfe/trunk/test/SemaTemplate/member-access-expr.cpp Thu Apr 14 18:47:07 2016
@@ -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
+
template<typename T>
void call_f0(T x) {
x.Base::f0();
@@ -28,15 +31,25 @@ void test_f0_through_typedef(X0 x0) {
template<typename TheBase, typename T>
void call_f0_through_typedef2(T x) {
- typedef TheBase CrazyBase; // expected-note{{current scope}}
- x.CrazyBase::f0(); // expected-error{{ambiguous}} \
- // expected-error 2{{no member named}}
+ typedef TheBase CrazyBase;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{lookup from the current scope refers here}}
+#endif
+
+ x.CrazyBase::f0(); // expected-error 2{{no member named}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{lookup of 'CrazyBase' in member access expression is ambiguous}}
+#endif
+
}
struct OtherBase { };
struct X1 : Base, OtherBase {
- typedef OtherBase CrazyBase; // expected-note{{object type}}
+ typedef OtherBase CrazyBase;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{lookup in the object type 'X1' refers here}}
+#endif
};
void test_f0_through_typedef2(X0 x0, X1 x1) {
Modified: cfe/trunk/test/SemaTemplate/recovery-crash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/recovery-crash.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/recovery-crash.cpp (original)
+++ cfe/trunk/test/SemaTemplate/recovery-crash.cpp Thu Apr 14 18:47:07 2016
@@ -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
// Clang used to crash trying to recover while adding 'this->' before Work(x);
@@ -25,14 +27,20 @@ namespace PR16134 {
namespace PR16225 {
template <typename T> void f();
- template<typename C> void g(C*) {
+ template <typename C> void g(C*) {
struct LocalStruct : UnknownBase<Mumble, C> { }; // expected-error {{unknown template name 'UnknownBase'}} \
// expected-error {{use of undeclared identifier 'Mumble'}}
- f<LocalStruct>(); // expected-warning {{template argument uses local type 'LocalStruct'}}
+ f<LocalStruct>();
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses local type 'LocalStruct'}}
+#endif
}
struct S;
void h() {
- g<S>(0); // expected-note {{in instantiation of function template specialization}}
+ g<S>(0);
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{in instantiation of function template specialization}}
+#endif
}
}
Modified: cfe/trunk/test/SemaTemplate/temp_arg_type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg_type.cpp?rev=266387&r1=266386&r2=266387&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg_type.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg_type.cpp Thu Apr 14 18:47:07 2016
@@ -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
+
template<typename T> class A; // expected-note 2 {{template parameter is declared here}} expected-note{{template is declared here}}
// [temp.arg.type]p1
@@ -24,11 +27,21 @@ A<ns::B> a8; // expected-error{{use of c
// [temp.arg.type]p2
void f() {
class X { };
- A<X> * a = 0; // expected-warning{{template argument uses local type 'X'}}
+ A<X> * a = 0;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{template argument uses local type 'X'}}
+#endif
}
-struct { int x; } Unnamed; // expected-note{{unnamed type used in template argument was declared here}}
-A<__typeof__(Unnamed)> *a9; // expected-warning{{template argument uses unnamed type}}
+struct { int x; } Unnamed;
+#if __cplusplus <= 199711L
+// expected-note at -2 {{unnamed type used in template argument was declared here}}
+#endif
+
+A<__typeof__(Unnamed)> *a9;
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{template argument uses unnamed type}}
+#endif
template<typename T, unsigned N>
struct Array {
More information about the cfe-commits
mailing list