r266239 - Lit C++11 Compatibility Patch #7
Charles Li via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 13 13:00:47 PDT 2016
Author: lcharles
Date: Wed Apr 13 15:00:45 2016
New Revision: 266239
URL: http://llvm.org/viewvc/llvm-project?rev=266239&view=rev
Log:
Lit C++11 Compatibility Patch #7
13 tests have been updated for C++11 compatibility.
Differential Revision: http://reviews.llvm.org/D19068
Modified:
cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp
cfe/trunk/test/SemaCXX/dcl_init_aggr.cpp
cfe/trunk/test/SemaCXX/type-convert-construct.cpp
cfe/trunk/test/SemaCXX/vararg-non-pod.cpp
cfe/trunk/test/SemaTemplate/class-template-spec.cpp
cfe/trunk/test/SemaTemplate/instantiate-cast.cpp
cfe/trunk/test/SemaTemplate/instantiate-expr-4.cpp
cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp
Modified: cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp (original)
+++ cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp Wed Apr 13 15:00:45 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
// This is just the test for [namespace.udecl]p4 with 'using'
// uniformly stripped out.
@@ -24,10 +26,33 @@ namespace test0 {
}
class Test0 {
- NonClass::type; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
- NonClass::hiding; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
- NonClass::union_member; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
- NonClass::enumerator; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
+ NonClass::type; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ NonClass::hiding; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ NonClass::union_member; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ NonClass::enumerator; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
};
}
@@ -43,11 +68,39 @@ namespace test1 {
};
struct B : A {
- A::type; // expected-warning {{access declarations are deprecated}}
- A::hiding; // expected-warning {{access declarations are deprecated}}
- A::union_member; // expected-warning {{access declarations are deprecated}}
- A::enumerator; // expected-warning {{access declarations are deprecated}}
- A::tagname; // expected-warning {{access declarations are deprecated}}
+ A::type;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+ A::hiding;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A::union_member;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A::enumerator;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A::tagname;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
void test0() {
type t = 0;
@@ -86,11 +139,40 @@ namespace test2 {
};
template <class T> struct B : A {
- A::type; // expected-warning {{access declarations are deprecated}}
- A::hiding; // expected-warning {{access declarations are deprecated}}
- A::union_member; // expected-warning {{access declarations are deprecated}}
- A::enumerator; // expected-warning {{access declarations are deprecated}}
- A::tagname; // expected-warning {{access declarations are deprecated}}
+ A::type;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A::hiding;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A::union_member;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A::enumerator;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A::tagname;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
void test0() {
type t = 0;
@@ -131,11 +213,40 @@ namespace test3 {
};
template <class T> struct B : A<T> {
- A<T>::type; // expected-error {{dependent using declaration resolved to type without 'typename'}} // expected-warning {{access declarations are deprecated}}
- A<T>::hiding; // expected-warning {{access declarations are deprecated}}
- A<T>::union_member; // expected-warning {{access declarations are deprecated}}
- A<T>::enumerator; // expected-warning {{access declarations are deprecated}}
- A<T>::tagname; // expected-error {{dependent using declaration resolved to type without 'typename'}} // expected-warning {{access declarations are deprecated}}
+ A<T>::type; // expected-error {{dependent using declaration resolved to type without 'typename'}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A<T>::hiding;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A<T>::union_member;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A<T>::enumerator;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ A<T>::tagname; // expected-error {{dependent using declaration resolved to type without 'typename'}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
// FIXME: re-enable these when the various bugs involving tags are fixed
#if 0
@@ -186,14 +297,54 @@ namespace test4 {
// We should be able to diagnose these without instantiation.
template <class T> struct C : Base {
- InnerNS::foo; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
- Base::bar; // expected-error {{no member named 'bar'}} expected-warning {{access declarations are deprecated}}
- Unrelated::foo; // expected-error {{not a base class}} expected-warning {{access declarations are deprecated}}
- C::foo; // legal in C++03 // expected-warning {{access declarations are deprecated}}
- Subclass::foo; // legal in C++03 // expected-warning {{access declarations are deprecated}}
+ InnerNS::foo; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ Base::bar; // expected-error {{no member named 'bar'}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
- int bar(); //expected-note {{target of using declaration}}
- C::bar; // expected-error {{refers to its own class}} expected-warning {{access declarations are deprecated}}
+ Unrelated::foo; // expected-error {{not a base class}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+ C::foo; // legal in C++03
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+ // expected-error at -5 {{using declaration refers to its own class}}
+#endif
+
+ Subclass::foo; // legal in C++03
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+ // expected-error at -5 {{using declaration refers into 'Subclass::', which is not a base class of 'C'}}
+#endif
+
+ int bar();
+#if __cplusplus <= 199711L
+ //expected-note at -2 {{target of using declaration}}
+#endif
+ C::bar;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{access declarations are deprecated; use using declarations instead}}
+#else
+ // expected-error at -4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+ // expected-error at -6 {{using declaration refers to its own class}}
};
}
Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp Wed Apr 13 15:00:45 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
+
// This test creates cases where implicit instantiations of various entities
// would cause a diagnostic, but provides expliict specializations for those
@@ -16,7 +19,10 @@ struct NonDefaultConstructible {
// -- function template
namespace N0 {
- template<typename T> void f0(T) { // expected-note{{here}}
+ template<typename T> void f0(T) {
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
T t;
}
@@ -36,7 +42,11 @@ namespace N1 {
template<> void N0::f0(long) { } // expected-error{{does not enclose namespace}}
}
-template<> void N0::f0(double); // expected-warning{{C++11 extension}}
+template<> void N0::f0(double);
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of function template specialization of 'f0' outside namespace 'N0' is a C++11 extension}}
+#endif
+
template<> void N0::f0(double) { }
struct X1 {
@@ -49,21 +59,39 @@ struct X1 {
namespace N0 {
template<typename T>
-struct X0 { // expected-note 2{{here}}
- static T member; // expected-note{{here}}
-
- void f1(T t) { // expected-note{{explicitly specialized declaration is here}}
+struct X0 { // expected-note {{explicitly specialized declaration is here}}
+#if __cplusplus <= 199711L
+// expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
+ static T member;
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
+
+ void f1(T t) {
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
t = 17;
}
- struct Inner : public T { }; // expected-note 3{{here}}
+ struct Inner : public T { }; // expected-note 2{{explicitly specialized declaration is here}}
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
template<typename U>
- struct InnerTemplate : public T { }; // expected-note 2{{explicitly specialized}} \
- // expected-error{{base specifier}}
+ struct InnerTemplate : public T { }; // expected-note {{explicitly specialized declaration is here}}
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
+ // expected-error at -4 {{base specifier must name a class}}
template<typename U>
- void ft1(T t, U u); // expected-note{{explicitly specialized}}
+ void ft1(T t, U u);
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
};
}
@@ -76,7 +104,10 @@ void N0::X0<T>::ft1(T t, U u) {
template<typename T> T N0::X0<T>::member;
-template<> struct N0::X0<void> { }; // expected-warning{{C++11 extension}}
+template<> struct N0::X0<void> { };
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of class template specialization of 'X0' outside namespace 'N0' is a C++11 extension}}
+#endif
N0::X0<void> test_X0;
namespace N1 {
@@ -92,7 +123,10 @@ template<> struct N0::X0<volatile void>
};
// -- member function of a class template
-template<> void N0::X0<void*>::f1(void *) { } // expected-warning{{member function specialization}}
+template<> void N0::X0<void*>::f1(void *) { }
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of member function specialization of 'f1' outside namespace 'N0' is a C++11 extension}}
+#endif
void test_spec(N0::X0<void*> xvp, void *vp) {
xvp.f1(vp);
@@ -125,7 +159,10 @@ NonDefaultConstructible &get_static_memb
return N0::X0<NonDefaultConstructible>::member;
}
-template<> int N0::X0<int>::member; // expected-warning{{C++11 extension}}
+template<> int N0::X0<int>::member;
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of static data member specialization of 'member' outside namespace 'N0' is a C++11 extension}}
+#endif
template<> float N0::X0<float>::member = 3.14f;
@@ -153,7 +190,10 @@ namespace N0 {
}
template<>
-struct N0::X0<long>::Inner { }; // expected-warning{{C++11 extension}}
+struct N0::X0<long>::Inner { };
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of member class specialization of 'Inner' outside namespace 'N0' is a C++11 extension}}
+#endif
template<>
struct N0::X0<float>::Inner { };
@@ -192,7 +232,10 @@ template<> template<>
struct N0::X0<int>::InnerTemplate<long> { }; // okay
template<> template<>
-struct N0::X0<int>::InnerTemplate<float> { }; // expected-warning{{class template specialization}}
+struct N0::X0<int>::InnerTemplate<float> { };
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of class template specialization of 'InnerTemplate' outside namespace 'N0' is a C++11 extension}}
+#endif
namespace N1 {
template<> template<>
@@ -224,7 +267,10 @@ template<> template<>
void N0::X0<void*>::ft1(void *, unsigned) { } // okay
template<> template<>
-void N0::X0<void*>::ft1(void *, float) { } // expected-warning{{function template specialization}}
+void N0::X0<void*>::ft1(void *, float) { }
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of function template specialization of 'ft1' outside namespace 'N0' is a C++11 extension}}
+#endif
namespace N1 {
template<> template<>
Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp Wed Apr 13 15:00:45 2016
@@ -1,14 +1,20 @@
// 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 N {
- template<class T> class X; // expected-note {{'N::X' declared here}} \
- // expected-note {{explicitly specialized declaration is here}}
+ template<class T> class X; // expected-note {{'N::X' declared here}}
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized declaration is here}}
+#endif
}
// TODO: Don't add a namespace qualifier to the template if it would trigger
// the warning about the specialization being outside of the namespace.
-template<> class X<int> { /* ... */ }; // expected-error {{no template named 'X'; did you mean 'N::X'?}} \
- // expected-warning {{first declaration of class template specialization of 'X' outside namespace 'N' is a C++11 extension}}
+template<> class X<int> { /* ... */ }; // expected-error {{no template named 'X'; did you mean 'N::X'?}}
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of class template specialization of 'X' outside namespace 'N' is a C++11 extension}}
+#endif
namespace N {
Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p2.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p2.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p2.cpp Wed Apr 13 15:00:45 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++98 -Wc++11-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++11 %s
// Example from the standard
template<class T> class Array { void mf() { } };
@@ -39,5 +41,16 @@ namespace N {
}
using namespace N;
-template struct X1<int>; // expected-warning{{must occur in}}
-template void f1(int); // expected-warning{{must occur in}}
+template struct X1<int>;
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{explicit instantiation of 'N::X1' must occur in namespace 'N'}}
+#else
+// expected-error at -4 {{explicit instantiation of 'N::X1' must occur in namespace 'N'}}
+#endif
+
+template void f1(int);
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{explicit instantiation of 'N::f1' must occur in namespace 'N'}}
+#else
+// expected-error at -4 {{explicit instantiation of 'N::f1' must occur in namespace 'N'}}
+#endif
Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp Wed Apr 13 15:00:45 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -Wc++11-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
namespace N {
template<class T> class Y { // expected-note{{explicit instantiation refers here}}
@@ -11,7 +13,12 @@ template class Z<int>; // expected-error
// FIXME: This example from the standard is wrong; note posted to CWG reflector
// on 10/27/2009
using N::Y;
-template class Y<int>; // expected-warning{{must occur in}}
+template class Y<int>;
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}}
+#else
+// expected-error at -4 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}}
+#endif
template class N::Y<char*>;
template void N::Y<double>::mf();
Modified: cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp Wed Apr 13 15:00:45 2016
@@ -1,4 +1,6 @@
// RUN: %clangxx -target x86_64-unknown-unknown -g %s -emit-llvm -S -o - | FileCheck %s
+// RUN: %clangxx -target x86_64-unknown-unknown -g -std=c++98 %s -emit-llvm -S -o - | FileCheck %s
+// RUN: %clangxx -target x86_64-unknown-unknown -g -std=c++11 %s -emit-llvm -S -o - | FileCheck %s
// PR14471
enum X {
@@ -10,7 +12,11 @@ class C
const static bool const_a = true;
protected:
static int b;
+#if __cplusplus >= 201103L
+ constexpr static float const_b = 3.14;
+#else
const static float const_b = 3.14;
+#endif
public:
static int c;
const static int const_c = 18;
Modified: cfe/trunk/test/SemaCXX/dcl_init_aggr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/dcl_init_aggr.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/dcl_init_aggr.cpp (original)
+++ cfe/trunk/test/SemaCXX/dcl_init_aggr.cpp Wed Apr 13 15:00:45 2016
@@ -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
// C++ [dcl.init.aggr]p2
struct A {
int x;
@@ -9,14 +11,29 @@ struct A {
} a1 = { 1, { 2, 3 } };
struct NonAggregate {
+#if __cplusplus >= 201103L
+// expected-note at -2 3 {{candidate constructor (the implicit copy constructor) not viable}}
+// expected-note at -3 3 {{candidate constructor (the implicit move constructor) not viable}}
+#endif
NonAggregate();
-
+#if __cplusplus >= 201103L
+// expected-note at -2 3 {{candidate constructor not viable: requires 0 arguments, but 2 were provided}}
+#endif
int a, b;
};
-NonAggregate non_aggregate_test = { 1, 2 }; // expected-error{{non-aggregate type 'NonAggregate' cannot be initialized with an initializer list}}
-
-NonAggregate non_aggregate_test2[2] = { { 1, 2 }, { 3, 4 } }; // expected-error 2 {{non-aggregate type 'NonAggregate' cannot be initialized with an initializer list}}
-
+NonAggregate non_aggregate_test = { 1, 2 };
+#if __cplusplus <= 199711L
+// expected-error at -2 {{non-aggregate type 'NonAggregate' cannot be initialized with an initializer list}}
+#else
+// expected-error at -4 {{no matching constructor for initialization of 'NonAggregate'}}
+#endif
+
+NonAggregate non_aggregate_test2[2] = { { 1, 2 }, { 3, 4 } };
+#if __cplusplus <= 199711L
+// expected-error at -2 2 {{non-aggregate type 'NonAggregate' cannot be initialized with an initializer list}}
+#else
+// expected-error at -4 2 {{no matching constructor for initialization of 'NonAggregate'}}
+#endif
// C++ [dcl.init.aggr]p3
A a_init = A();
@@ -38,20 +55,55 @@ char cv[4] = { 'a', 's', 'd', 'f', 0 };
// C++ [dcl.init.aggr]p7
struct TooFew { int a; char* b; int c; };
-TooFew too_few = { 1, "asdf" }; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
+TooFew too_few = { 1, "asdf" };
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{conversion from string literal to 'char *' is deprecated}}
+#else
+// expected-warning at -4 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
+#endif
+
+struct NoDefaultConstructor {
+#if __cplusplus <= 199711L
+// expected-note at -2 3 {{candidate constructor (the implicit copy constructor)}}
+// expected-note at -3 {{declared here}}
+#else
+// expected-note at -5 4 {{candidate constructor (the implicit copy constructor)}}
+// expected-note at -6 4 {{candidate constructor (the implicit move constructor)}}
+#endif
+
+ NoDefaultConstructor(int);
+#if __cplusplus <= 199711L
+ // expected-note at -2 3 {{candidate constructor not viable: requires 1 argument, but 0 were provided}}
+#else
+ // expected-note at -4 4 {{candidate constructor not viable: requires 1 argument, but 0 were provided}}
+#endif
+
+};
+struct TooFewError {
+#if __cplusplus <= 199711L
+// expected-error at -2 {{implicit default constructor for}}
+#endif
-struct NoDefaultConstructor { // expected-note 3 {{candidate constructor (the implicit copy constructor)}} \
- // expected-note{{declared here}}
- NoDefaultConstructor(int); // expected-note 3 {{candidate constructor}}
-};
-struct TooFewError { // expected-error{{implicit default constructor for}}
int a;
- NoDefaultConstructor nodef; // expected-note{{member is declared here}} expected-note 2{{in implicit initialization of field 'nodef'}}
+ NoDefaultConstructor nodef;
+#if __cplusplus <= 199711L
+// expected-note at -2 {{member is declared here}}
+// expected-note at -3 2{{in implicit initialization of field 'nodef' with omitted initializer}}
+#else
+// expected-note at -5 3{{in implicit initialization of field 'nodef' with omitted initializer}}
+#endif
};
TooFewError too_few_okay = { 1, 1 };
TooFewError too_few_error = { 1 }; // expected-error{{no matching constructor}}
-TooFewError too_few_okay2[2] = { 1, 1 }; // expected-note{{implicit default constructor for 'TooFewError' first required here}}
+TooFewError too_few_okay2[2] = { 1, 1 };
+#if __cplusplus <= 199711L
+// expected-note at -2 {{implicit default constructor for 'TooFewError' first required here}}
+#else
+// expected-error at -4 {{no matching constructor for initialization of 'NoDefaultConstructor'}}
+// expected-note at -5 {{in implicit initialization of array element 1 with omitted initializer}}
+#endif
+
TooFewError too_few_error2[2] = { 1 }; // expected-error{{no matching constructor}}
NoDefaultConstructor too_few_error3[3] = { }; // expected-error {{no matching constructor}} expected-note {{implicit initialization of array element 0}}
@@ -116,6 +168,10 @@ B2 b2_3 = { c2, a2, a2 };
// C++ [dcl.init.aggr]p15:
union u { int a; char* b; }; // expected-note{{candidate constructor (the implicit copy constructor)}}
+#if __cplusplus >= 201103L
+// expected-note at -2 {{candidate constructor (the implicit move constructor)}}
+#endif
+
u u1 = { 1 };
u u2 = u1;
u u3 = 1; // expected-error{{no viable conversion}}
Modified: cfe/trunk/test/SemaCXX/type-convert-construct.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-convert-construct.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/type-convert-construct.cpp (original)
+++ cfe/trunk/test/SemaCXX/type-convert-construct.cpp Wed Apr 13 15:00:45 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %s
void f() {
float v1 = float(1);
@@ -12,8 +14,21 @@ void f() {
typedef int T;
int *p;
bool v6 = T(0) == p;
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{comparison between pointer and integer ('T' (aka 'int') and 'int *')}}
+#endif
char *str;
- str = "a string"; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
+ str = "a string";
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{conversion from string literal to 'char *' is deprecated}}
+#else
+ // expected-warning at -4 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
+#endif
wchar_t *wstr;
- wstr = L"a wide string"; // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}}
+ wstr = L"a wide string";
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{conversion from string literal to 'wchar_t *' is deprecated}}
+#else
+ // expected-warning at -4 {{ISO C++11 does not allow conversion from string literal to 'wchar_t *'}}
+#endif
}
Modified: cfe/trunk/test/SemaCXX/vararg-non-pod.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/vararg-non-pod.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/vararg-non-pod.cpp (original)
+++ cfe/trunk/test/SemaCXX/vararg-non-pod.cpp Wed Apr 13 15:00:45 2016
@@ -1,7 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=c++98 %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=c++11 %s -Wno-error=non-pod-varargs
// Check that the warning is still there under -fms-compatibility.
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-error=non-pod-varargs -fms-compatibility
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=c++98 %s -Wno-error=non-pod-varargs -fms-compatibility
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=c++11 %s -Wno-error=non-pod-varargs -fms-compatibility
extern char version[];
@@ -18,11 +22,19 @@ void t1()
{
C c(10);
- g(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+ g(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+#endif
+
g(10, version);
void (*ptr)(int, ...) = g;
- ptr(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+ ptr(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+#endif
+
ptr(10, version);
}
@@ -30,18 +42,34 @@ void t2()
{
C c(10);
- c.g(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+ c.g(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+#endif
+
c.g(10, version);
void (C::*ptr)(int, ...) = &C::g;
- (c.*ptr)(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+ (c.*ptr)(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+#endif
+
(c.*ptr)(10, version);
- C::h(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+ C::h(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+#endif
+
C::h(10, version);
void (*static_ptr)(int, ...) = &C::h;
- static_ptr(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+ static_ptr(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+#endif
+
static_ptr(10, version);
}
@@ -51,7 +79,11 @@ void t3()
{
C c(10);
- block(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
+ block(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
+#endif
+
block(10, version);
}
@@ -66,7 +98,11 @@ void t4()
D d;
- d(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+ d(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+#endif
+
d(10, version);
}
@@ -78,10 +114,16 @@ void t5()
{
C c(10);
- E e(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic constructor; call will abort at runtime}} \
- // expected-error{{calling a private constructor of class 'E'}}
- (void)E(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic constructor; call will abort at runtime}} \
- // expected-error{{calling a private constructor of class 'E'}}
+ E e(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic constructor; call will abort at runtime}}
+#endif
+ // expected-error at -4 {{calling a private constructor of class 'E'}}
+ (void)E(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic constructor; call will abort at runtime}}
+#endif
+ // expected-error at -4 {{calling a private constructor of class 'E'}}
}
@@ -103,7 +145,13 @@ Base &get_base(...);
int eat_base(...);
void test_typeid(Base &base) {
- (void)typeid(get_base(base)); // expected-warning{{cannot pass object of non-POD type 'Base' through variadic function; call will abort at runtime}} expected-warning{{expression with side effects will be evaluated despite being used as an operand to 'typeid'}}
+ (void)typeid(get_base(base));
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'Base' through variadic function; call will abort at runtime}}
+#else
+ // expected-warning at -4 {{cannot pass object of non-trivial type 'Base' through variadic function; call will abort at runtime}}
+#endif
+ // expected-warning at -6 {{expression with side effects will be evaluated despite being used as an operand to 'typeid'}}
(void)typeid(eat_base(base)); // okay
}
@@ -136,7 +184,10 @@ void t8(int n, ...) {
int t9(int n) {
// Make sure the error works in potentially-evaluated sizeof
- return (int)sizeof(*(Helper(Foo()), (int (*)[n])0)); // expected-warning{{cannot pass object of non-POD type}}
+ return (int)sizeof(*(Helper(Foo()), (int (*)[n])0));
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'Foo' through variadic function; call will abort at runtime}}
+#endif
}
// PR14057
@@ -173,22 +224,43 @@ namespace t11 {
void test() {
C c(10);
- (get_f_ptr())(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+ (get_f_ptr())(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+#endif
(get_f_ptr())(10, version);
- (c.*get_m_ptr())(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+ (c.*get_m_ptr())(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+#endif
(c.*get_m_ptr())(10, version);
- (get_b_ptr())(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
+ (get_b_ptr())(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
+#endif
+
(get_b_ptr())(10, version);
- (arr_f_ptr[3])(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+ (arr_f_ptr[3])(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}}
+#endif
+
(arr_f_ptr[3])(10, version);
- (c.*arr_m_ptr[3])(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+ (c.*arr_m_ptr[3])(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}}
+#endif
+
(c.*arr_m_ptr[3])(10, version);
- (arr_b_ptr[3])(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
+ (arr_b_ptr[3])(10, c);
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}}
+#endif
(arr_b_ptr[3])(10, version);
}
}
Modified: cfe/trunk/test/SemaTemplate/class-template-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/class-template-spec.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/class-template-spec.cpp (original)
+++ cfe/trunk/test/SemaTemplate/class-template-spec.cpp Wed Apr 13 15:00:45 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
template<typename T, typename U = int> struct A; // expected-note {{template is declared here}} \
// expected-note{{explicitly specialized}}
@@ -75,7 +77,10 @@ struct A<double> { }; // expected-error{
template<> struct ::A<double>;
namespace N {
- template<typename T> struct B; // expected-note 2{{explicitly specialized}}
+ template<typename T> struct B; // expected-note {{explicitly specialized}}
+#if __cplusplus <= 199711L
+ // expected-note at -2 {{explicitly specialized}}
+#endif
template<> struct ::N::B<char>; // okay
template<> struct ::N::B<short>; // okay
@@ -86,7 +91,11 @@ namespace N {
template<> struct N::B<int> { }; // okay
-template<> struct N::B<float> { }; // expected-warning{{C++11 extension}}
+template<> struct N::B<float> { };
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{first declaration of class template specialization of 'B' outside namespace 'N' is a C++11 extension}}
+#endif
+
namespace M {
template<> struct ::N::B<short> { }; // expected-error{{class template specialization of 'B' not in a namespace enclosing 'N'}}
@@ -142,13 +151,26 @@ namespace PR18009 {
}
namespace PR16519 {
- template<typename T, T...N> struct integer_sequence { typedef T value_type; }; // expected-warning {{extension}}
+ template<typename T, T...N> struct integer_sequence { typedef T value_type; };
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{variadic templates are a C++11 extension}}
+#endif
template<typename T> struct __make_integer_sequence;
- template<typename T, T N> using make_integer_sequence = typename __make_integer_sequence<T>::template make<N, N % 2>::type; // expected-warning {{extension}}
-
- template<typename T, typename T::value_type ...Extra> struct __make_integer_sequence_impl; // expected-warning {{extension}}
- template<typename T, T ...N, T ...Extra> struct __make_integer_sequence_impl<integer_sequence<T, N...>, Extra...> { // expected-warning 2{{extension}}
+ template<typename T, T N> using make_integer_sequence = typename __make_integer_sequence<T>::template make<N, N % 2>::type;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{alias declarations are a C++11 extension}}
+#endif
+
+ template<typename T, typename T::value_type ...Extra> struct __make_integer_sequence_impl;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{variadic templates are a C++11 extension}}
+#endif
+
+ template<typename T, T ...N, T ...Extra> struct __make_integer_sequence_impl<integer_sequence<T, N...>, Extra...> {
+#if __cplusplus <= 199711L
+ // expected-warning at -2 2 {{variadic templates are a C++11 extension}}
+#endif
typedef integer_sequence<T, N..., sizeof...(N) + N..., Extra...> type;
};
@@ -160,8 +182,15 @@ namespace PR16519 {
template<T N, typename Dummy> struct make<N, 1, Dummy> : __make_integer_sequence_impl<make_integer_sequence<T, N/2>, N - 1> {};
};
- using X = make_integer_sequence<int, 5>; // expected-warning {{extension}}
- using X = integer_sequence<int, 0, 1, 2, 3, 4>; // expected-warning {{extension}}
+ using X = make_integer_sequence<int, 5>;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{alias declarations are a C++11 extension}}
+#endif
+
+ using X = integer_sequence<int, 0, 1, 2, 3, 4>;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{alias declarations are a C++11 extension}}
+#endif
}
namespace DefaultArgVsPartialSpec {
Modified: cfe/trunk/test/SemaTemplate/instantiate-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-cast.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-cast.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-cast.cpp Wed Apr 13 15:00:45 2016
@@ -1,6 +1,13 @@
// 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 { int x; }; // expected-note 2 {{candidate constructor}}
+struct A { int x; };
+// expected-note at -1 {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const A' for 1st argument}}
+#if __cplusplus >= 201103L
+// expected-note at -3 {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'A' for 1st argument}}
+#endif
+// expected-note at -5 {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
class Base {
public:
Modified: cfe/trunk/test/SemaTemplate/instantiate-expr-4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-expr-4.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-expr-4.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-expr-4.cpp Wed Apr 13 15:00:45 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
// ---------------------------------------------------------------------
// C++ Functional Casts
@@ -22,6 +24,9 @@ struct FunctionalCast0 {
template struct FunctionalCast0<5>;
struct X { // expected-note 3 {{candidate constructor (the implicit copy constructor)}}
+#if __cplusplus >= 201103L
+// expected-note at -2 3 {{candidate constructor (the implicit move constructor) not viable}}
+#endif
X(int, int); // expected-note 3 {{candidate constructor}}
};
@@ -213,6 +218,10 @@ template<typename T, typename Val1>
struct InitList1 {
void f(Val1 val1) {
T x = { val1 };
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{type 'float' cannot be narrowed to 'int' in initializer list}}
+ // expected-note at -3 {{insert an explicit cast to silence this issue}}
+#endif
}
};
@@ -222,6 +231,9 @@ struct APair {
};
template struct InitList1<int[1], float>;
+#if __cplusplus >= 201103L
+// expected-note at -2 {{instantiation of member function}}
+#endif
template struct InitList1<APair, int*>;
template<typename T, typename Val1, typename Val2>
Modified: cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp?rev=266239&r1=266238&r2=266239&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp Wed Apr 13 15:00:45 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
namespace PR8965 {
template<typename T>
@@ -106,7 +108,10 @@ namespace test2 {
namespace AliasTagDef {
template<typename T>
struct F {
- using S = struct U { // expected-warning {{C++11}}
+ using S = struct U {
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{alias declarations are a C++11 extension}}
+#endif
T g() {
return T();
}
@@ -122,8 +127,13 @@ namespace rdar10397846 {
{
struct B
{
- struct C { C() { int *ptr = I; } }; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} \
- expected-warning{{expression which evaluates to zero treated as a null pointer constant of type 'int *'}}
+ struct C { C() { int *ptr = I; } };
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+#else
+ // expected-warning at -4 {{expression which evaluates to zero treated as a null pointer constant of type 'int *'}}
+#endif
+ // expected-error at -6 {{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
};
};
More information about the cfe-commits
mailing list