r255196 - [Lit Test] Updated 20 Lit tests to be C++11 compatible.
Charles Li via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 9 17:07:18 PST 2015
Author: lcharles
Date: Wed Dec 9 19:07:17 2015
New Revision: 255196
URL: http://llvm.org/viewvc/llvm-project?rev=255196&view=rev
Log:
[Lit Test] Updated 20 Lit tests to be C++11 compatible.
This is the 5th Lit test patch.
Expanded expected diagnostics to vary by C++ dialect.
Expanded RUN line to: default, C++98/03 and C++11.
Modified:
cfe/trunk/test/CXX/class/class.nest/p1.cpp
cfe/trunk/test/Parser/cxx-casting.cpp
cfe/trunk/test/Parser/cxx-reference.cpp
cfe/trunk/test/Parser/cxx-template-argument.cpp
cfe/trunk/test/Parser/cxx-typeof.cpp
cfe/trunk/test/Parser/objc-init.m
cfe/trunk/test/Parser/objcxx-lambda-expressions-neg.mm
cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
cfe/trunk/test/SemaCXX/overload-call.cpp
cfe/trunk/test/SemaCXX/pragma-init_seg.cpp
cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
cfe/trunk/test/SemaCXX/unknown-type-name.cpp
cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp
cfe/trunk/test/SemaObjCXX/message.mm
cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp
cfe/trunk/test/SemaTemplate/instantiate-static-var.cpp
cfe/trunk/test/SemaTemplate/nested-name-spec-template.cpp
cfe/trunk/test/SemaTemplate/overload-candidates.cpp
cfe/trunk/test/SemaTemplate/partial-spec-instantiate.cpp
cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
Modified: cfe/trunk/test/CXX/class/class.nest/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.nest/p1.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/class.nest/p1.cpp (original)
+++ cfe/trunk/test/CXX/class/class.nest/p1.cpp Wed Dec 9 19:07:17 2015
@@ -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 Outer {
int x;
@@ -7,7 +9,10 @@ class Outer {
// C++11 does relax this rule (see 5.1.1.10) in the first case, but we need to enforce it in C++03 mode.
class Inner {
- static char a[sizeof(x)]; // expected-error {{invalid use of non-static data member 'x'}}
+ static char a[sizeof(x)];
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{invalid use of non-static data member 'x'}}
+#endif
static char b[sizeof(sx)]; // okay
static char c[sizeof(f)]; // expected-error {{call to non-static member function without an object argument}}
};
Modified: cfe/trunk/test/Parser/cxx-casting.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-casting.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-casting.cpp (original)
+++ cfe/trunk/test/Parser/cxx-casting.cpp Wed Dec 9 19:07:17 2015
@@ -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
char *const_cast_test(const char *var)
{
@@ -41,10 +43,25 @@ namespace test1 {
typedef char* c;
typedef A* a;
void test2(char x, struct B * b) {
- (void)const_cast<::c>(&x); // expected-error{{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
- (void)dynamic_cast<::a>(b); // expected-error{{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
- (void)reinterpret_cast<::c>(x); // expected-error{{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
- (void)static_cast<::c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)const_cast<::c>(&x);
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
+
+ (void)dynamic_cast<::a>(b);
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
+
+ (void)reinterpret_cast<::c>(x);
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
+
+ (void)static_cast<::c>(&x);
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
// Do not do digraph correction.
(void)static_cast<: :c>(&x); //\
@@ -64,8 +81,15 @@ void test2(char x, struct B * b) {
(void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
#define LCC <::
- test1::A LCC B> e; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
- (void)static_cast LCC c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ test1::A LCC B> e;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
+
+ (void)static_cast LCC c>(&x);
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
}
// This note comes from "::D[:F> A5;"
@@ -74,10 +98,25 @@ template <class T> void E() {};
class F {};
void test3() {
- ::D<::F> A1; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
- D<::F> A2; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
- ::E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
- E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ ::D<::F> A1;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
+
+ D<::F> A2;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
+
+ ::E<::F>();
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
+
+ E<::F>();
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
::D< ::F> A3;
D< ::F> A4;
Modified: cfe/trunk/test/Parser/cxx-reference.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-reference.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-reference.cpp (original)
+++ cfe/trunk/test/Parser/cxx-reference.cpp Wed Dec 9 19:07:17 2015
@@ -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
extern char *bork;
char *& bar = bork;
@@ -18,4 +20,7 @@ int & volatile Y = val; // expected-erro
int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
expected-error {{'volatile' qualifier may not be applied}} */
-typedef int && RV; // expected-warning {{rvalue references are a C++11 extension}}
+typedef int && RV;
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{rvalue references are a C++11 extension}}
+#endif
Modified: cfe/trunk/test/Parser/cxx-template-argument.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-template-argument.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-template-argument.cpp (original)
+++ cfe/trunk/test/Parser/cxx-template-argument.cpp Wed Dec 9 19:07:17 2015
@@ -1,5 +1,9 @@
// 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: %clang_cc1 -fsyntax-only -verify %s -fdelayed-template-parsing
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -fdelayed-template-parsing
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -fdelayed-template-parsing
template<typename T> struct A {};
@@ -22,7 +26,10 @@ namespace greatergreater {
void (*p)() = &t<int>;
(void)(&t<int>==p); // expected-error {{use '> ='}}
(void)(&t<int>>=p); // expected-error {{use '> >'}}
- (void)(&t<S<int>>>=p); // expected-error {{use '> >'}}
+ (void)(&t<S<int>>>=p);
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{use '> >'}}
+#endif
(void)(&t<S<int>>==p); // expected-error {{use '> >'}} expected-error {{use '> ='}}
}
}
@@ -72,13 +79,17 @@ namespace pr16225add {
{ };
template<class T1, typename T2> struct foo5 :
- UnknownBase<T1,T2,ABC<T2,T1>> // expected-error {{unknown template name 'UnknownBase'}} \
- // expected-error {{use '> >'}}
+ UnknownBase<T1,T2,ABC<T2,T1>> // expected-error {{unknown template name 'UnknownBase'}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{use '> >'}}
+#endif
{ };
template<class T1, typename T2> struct foo6 :
- UnknownBase<T1,ABC<T2,T1>>, // expected-error {{unknown template name 'UnknownBase'}} \
- // expected-error {{use '> >'}}
+ UnknownBase<T1,ABC<T2,T1>>, // expected-error {{unknown template name 'UnknownBase'}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{use '> >'}}
+#endif
Known<T1> // expected-error {{too few template arguments for class template 'Known'}}
{ };
@@ -87,18 +98,24 @@ namespace pr16225add {
{ };
template<class T1, typename T2> struct foo8 :
- UnknownBase<X<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}} \
- // expected-error {{use '> >'}}
+ UnknownBase<X<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{use '> >'}}
+#endif
{ };
template<class T1, typename T2> struct foo9 :
- UnknownBase<Known<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}} \
- // expected-error {{use '> >'}}
+ UnknownBase<Known<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{use '> >'}}
+#endif
{ };
template<class T1, typename T2> struct foo10 :
- UnknownBase<Known<int,int>,X<int,X<int,int>>> // expected-error {{unknown template name 'UnknownBase'}} \
- // expected-error {{use '> >'}}
+ UnknownBase<Known<int,int>,X<int,X<int,int>>> // expected-error {{unknown template name 'UnknownBase'}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{use '> >'}}
+#endif
{ };
template<int N1, int N2> struct foo11 :
Modified: cfe/trunk/test/Parser/cxx-typeof.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-typeof.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-typeof.cpp (original)
+++ cfe/trunk/test/Parser/cxx-typeof.cpp Wed Dec 9 19:07:17 2015
@@ -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
static void test() {
int *pi;
@@ -9,5 +11,10 @@ static void test() {
// Part of rdar://problem/8347416; from the gcc test suite.
struct S {
int i;
- __typeof(S::i) foo(); // expected-error {{invalid use of non-static data member 'i'}}
+ __typeof(S::i) foo();
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{invalid use of non-static data member 'i'}}
+#else
+ // expected-no-diagnostics
+#endif
};
Modified: cfe/trunk/test/Parser/objc-init.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-init.m?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-init.m (original)
+++ cfe/trunk/test/Parser/objc-init.m Wed Dec 9 19:07:17 2015
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -pedantic -Wno-objc-root-class %s
// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class -std=c++11 %s
// rdar://5707001
@interface NSNumber;
@@ -36,8 +38,16 @@ void test5(NSNumber *x) {
};
struct SomeStruct z = {
- .x = [x METH2], // ok.
+ .x = [x METH2], // ok in C++98.
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}}
+ // expected-note at -3 {{insert an explicit cast to silence this issue}}
+#endif
.x [x METH2] // expected-error {{expected '=' or another designator}}
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}}
+ // expected-note at -3 {{insert an explicit cast to silence this issue}}
+#endif
};
}
Modified: cfe/trunk/test/Parser/objcxx-lambda-expressions-neg.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objcxx-lambda-expressions-neg.mm?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objcxx-lambda-expressions-neg.mm (original)
+++ cfe/trunk/test/Parser/objcxx-lambda-expressions-neg.mm Wed Dec 9 19:07:17 2015
@@ -1,5 +1,13 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++11 %s
int main() {
- []{}; // expected-error {{expected expression}}
+ []{};
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{expected expression}}
+#else
+ // expected-no-diagnostics
+#endif
+
}
Modified: cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp (original)
+++ cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp Wed Dec 9 19:07:17 2015
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -Wno-int-to-pointer-cast -fsyntax-only -verify -pedantic-errors %s
+// RUN: %clang_cc1 -Wno-int-to-pointer-cast -fsyntax-only -verify -pedantic-errors -std=gnu++98 %s
+// RUN: %clang_cc1 -Wno-int-to-pointer-cast -fsyntax-only -verify -pedantic-errors -std=gnu++11 %s
// RUN: %clang_cc1 -Wno-int-to-pointer-cast -fsyntax-only -verify -pedantic-errors -x objective-c++ %s
void f() {
@@ -60,6 +62,9 @@ namespace N {
func(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
S s(); // expected-warning {{function declaration}}
+#if __cplusplus >= 201103L
+ // expected-note at -2 {{replace parentheses with an initializer to declare a variable}}
+#endif
}
void nonEmptyParens() {
int f = 0, // g = 0; expected-note {{change this ',' to a ';' to call 'func2'}}
Modified: cfe/trunk/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call.cpp Wed Dec 9 19:07:17 2015
@@ -1,4 +1,7 @@
// RUN: %clang_cc1 -triple %itanium_abi_triple -pedantic -verify %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -pedantic -verify -std=c++98 %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -pedantic -verify -std=c++11 %s
+
int* f(int) { return 0; }
float* f(float) { return 0; }
void f();
@@ -53,8 +56,19 @@ int* k(char*);
double* k(bool);
void test_k() {
- int* ip1 = k("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
- int* ip2 = k(("foo")); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
+ int* ip1 = k("foo");
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{conversion from string literal to 'char *' is deprecated}}
+#else
+ // expected-error at -4 {{cannot initialize a variable of type 'int *' with an rvalue of type 'double *'}}
+#endif
+
+ int* ip2 = k(("foo"));
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{conversion from string literal to 'char *' is deprecated}}
+#else
+ // expected-error at -4 {{cannot initialize a variable of type 'int *' with an rvalue of type 'double *'}}
+#endif
double* dp1 = k(L"foo");
}
@@ -62,7 +76,12 @@ int* l(wchar_t*);
double* l(bool);
void test_l() {
- int* ip1 = l(L"foo"); // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}}
+ int* ip1 = l(L"foo");
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{conversion from string literal to 'wchar_t *' is deprecated}}
+#else
+ // expected-error at -4 {{cannot initialize a variable of type 'int *' with an rvalue of type 'double *'}}
+#endif
double* dp1 = l("foo");
}
@@ -80,8 +99,12 @@ class E;
void test_n(E* e) {
char ca[7];
int* ip1 = n(ca);
- int* ip2 = n("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
-
+ int* ip2 = n("foo");
+#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
float fa[7];
double* dp1 = n(fa);
@@ -593,8 +616,16 @@ void test5() {
namespace PR20218 {
void f(void (*const &)()); // expected-note 2{{candidate}}
- void f(void (&&)()) = delete; // expected-note 2{{candidate}} expected-warning 2{{extension}}
- void g(void (&&)()) = delete; // expected-note 2{{candidate}} expected-warning 2{{extension}}
+ void f(void (&&)()) = delete; // expected-note 2{{candidate}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{rvalue references are a C++11 extension}}
+ // expected-warning at -3 {{deleted function definitions are a C++11 extension}}
+#endif
+ void g(void (&&)()) = delete; // expected-note 2{{candidate}}
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{rvalue references are a C++11 extension}}
+ // expected-warning at -3 {{deleted function definitions are a C++11 extension}}
+#endif
void g(void (*const &)()); // expected-note 2{{candidate}}
void x();
Modified: cfe/trunk/test/SemaCXX/pragma-init_seg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/pragma-init_seg.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/pragma-init_seg.cpp (original)
+++ cfe/trunk/test/SemaCXX/pragma-init_seg.cpp Wed Dec 9 19:07:17 2015
@@ -1,5 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple x86_64-pc-win32
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -std=c++98 %s -triple x86_64-pc-win32
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -std=c++11 %s -triple x86_64-pc-win32
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple i386-apple-darwin13.3.0
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -std=c++98 %s -triple i386-apple-darwin13.3.0
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -std=c++11 %s -triple i386-apple-darwin13.3.0
#ifndef __APPLE__
#pragma init_seg(L".my_seg") // expected-warning {{expected 'compiler', 'lib', 'user', or a string literal}}
@@ -19,3 +23,6 @@
int f();
int __declspec(thread) x = f(); // expected-error {{initializer for thread-local variable must be a constant expression}}
+#if __cplusplus >= 201103L
+// expected-note at -2 {{use 'thread_local' to allow this}}
+#endif
Modified: cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp Wed Dec 9 19:07:17 2015
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++11-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -Wno-c++11-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct A {};
struct B {};
@@ -109,8 +111,10 @@ S<1> s;
namespace foo {}
void test_paren_suffix() {
- foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace 'foo'{{$}}}} \
- // expected-error {{expected expression}}
+ foo::bar({5, 6}); // expected-error-re {{no member named 'bar' in namespace 'foo'{{$}}}}
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{expected expression}}
+#endif
}
const int kNum = 10; // expected-note {{'kNum' declared here}}
Modified: cfe/trunk/test/SemaCXX/unknown-type-name.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/unknown-type-name.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/unknown-type-name.cpp (original)
+++ cfe/trunk/test/SemaCXX/unknown-type-name.cpp Wed Dec 9 19:07:17 2015
@@ -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
// PR3990
namespace N {
@@ -95,7 +97,11 @@ template<typename T> int h(T::type x, ch
template<typename T> int junk1(T::junk); // expected-warning{{variable templates are a C++14 extension}}
template<typename T> int junk2(T::junk) throw(); // expected-error{{missing 'typename'}}
-template<typename T> int junk3(T::junk) = delete; // expected-error{{missing 'typename'}} expected-warning{{C++11}}
+template<typename T> int junk3(T::junk) = delete; // expected-error{{missing 'typename'}}
+#if __cplusplus <= 199711L
+//expected-warning at -2 {{deleted function definitions are a C++11 extension}}
+#endif
+
template<typename T> int junk4(T::junk j); // expected-error{{missing 'typename'}}
// FIXME: We can tell this was intended to be a function because it does not
Modified: cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp Wed Dec 9 19:07:17 2015
@@ -1,25 +1,31 @@
-// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
-// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated -Wdeprecated-increment-bool -verify %s
-// RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s
-// RUN: %clang_cc1 -fsyntax-only -Wno-write-strings -verify %s
-// RUN: %clang_cc1 -fsyntax-only -Werror=c++11-compat -verify %s -DERROR
-// RUN: %clang_cc1 -fsyntax-only -Werror=deprecated -Wno-error=deprecated-increment-bool -verify %s -DERROR
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wno-deprecated -Wdeprecated-increment-bool
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DWARNING
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s -DWARNING
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated-writable-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated -Wdeprecated-increment-bool -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -fwritable-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-write-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=c++11-compat -verify %s -DERROR
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=deprecated -Wno-error=deprecated-increment-bool -verify %s -DERROR
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -DWARNING
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wno-deprecated -Wdeprecated-increment-bool -DWARNING
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -pedantic-errors -DERROR
// rdar://8827606
char *fun(void)
{
return "foo";
+#if defined(ERROR)
#if __cplusplus >= 201103L
-#ifdef ERROR
// expected-error at -3 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
#else
- // expected-warning at -5 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
+ // expected-error at -5 {{conversion from string literal to 'char *' is deprecated}}
+#endif
+#elif defined(WARNING)
+#if __cplusplus >= 201103L
+ // expected-warning at -9 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
+#else
+ // expected-warning at -11 {{conversion from string literal to 'char *' is deprecated}}
#endif
-#elif defined(ERROR)
- // expected-error at -8 {{deprecated}}
#endif
}
Modified: cfe/trunk/test/SemaObjCXX/message.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/message.mm?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/message.mm (original)
+++ cfe/trunk/test/SemaObjCXX/message.mm Wed Dec 9 19:07:17 2015
@@ -1,4 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile-10.5 -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile-10.5 -verify -Wno-objc-root-class -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile-10.5 -verify -Wno-objc-root-class -std=c++11 %s
+
@interface I1
- (int*)method;
@end
@@ -62,15 +65,25 @@ struct identity {
// or typename-specifiers.
if (false) {
if (true)
- return [typename identity<I3>::type method]; // expected-warning{{occurs outside of a template}}
+ return [typename identity<I3>::type method];
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{'typename' occurs outside of a template}}
+#endif
return [::I3 method];
}
int* ip1 = {[super method]};
int* ip2 = {[::I3 method]};
- int* ip3 = {[typename identity<I3>::type method]}; // expected-warning{{occurs outside of a template}}
- int* ip4 = {[typename identity<I2_holder>::type().get() method]}; // expected-warning{{occurs outside of a template}}
+ int* ip3 = {[typename identity<I3>::type method]};
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{'typename' occurs outside of a template}}
+#endif
+
+ int* ip4 = {[typename identity<I2_holder>::type().get() method]};
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{'typename' occurs outside of a template}}
+#endif
int array[5] = {[3] = 2};
return [super method];
}
Modified: cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp Wed Dec 9 19:07:17 2015
@@ -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> struct S {
S() { }
S(T t);
@@ -46,7 +49,10 @@ namespace PR9654 {
namespace AliasTagDef {
template<typename T>
T f() {
- using S = struct { // expected-warning {{C++11}}
+ using S = struct {
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{alias declarations are a C++11 extension}}
+#endif
T g() {
return T();
}
Modified: cfe/trunk/test/SemaTemplate/instantiate-static-var.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-static-var.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-static-var.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-static-var.cpp Wed Dec 9 19:07:17 2015
@@ -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, T Divisor>
class X {
public:
@@ -11,7 +14,13 @@ X<int, 0> xi0; // expected-note{{in inst
template<typename T>
class Y {
- static const T value = 0; // expected-warning{{in-class initializer for static data member of type 'const float' is a GNU extension}}
+ static const T value = 0;
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{in-class initializer for static data member of type 'const float' is a GNU extension}}
+#else
+// expected-error at -4 {{in-class initializer for static data member of type 'const float' requires 'constexpr' specifier}}
+// expected-note at -5 {{add 'constexpr'}}
+#endif
};
Y<float> fy; // expected-note{{in instantiation of template class 'Y<float>' requested here}}
Modified: cfe/trunk/test/SemaTemplate/nested-name-spec-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/nested-name-spec-template.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/nested-name-spec-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/nested-name-spec-template.cpp Wed Dec 9 19:07:17 2015
@@ -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 N {
namespace M {
@@ -21,8 +23,15 @@ namespace N {
}
M::Promote<int>::type *ret_intptr3(int* ip) { return ip; }
- M::template Promote<int>::type *ret_intptr4(int* ip) { return ip; } // expected-warning{{'template' keyword outside of a template}}
- M::template Promote<int> pi; // expected-warning{{'template' keyword outside of a template}}
+ M::template Promote<int>::type *ret_intptr4(int* ip) { return ip; }
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{'template' keyword outside of a template}}
+#endif
+
+ M::template Promote<int> pi;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{'template' keyword outside of a template}}
+#endif
}
N::M::Promote<int>::type *ret_intptr5(int* ip) { return ip; }
Modified: cfe/trunk/test/SemaTemplate/overload-candidates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/overload-candidates.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/overload-candidates.cpp (original)
+++ cfe/trunk/test/SemaTemplate/overload-candidates.cpp Wed Dec 9 19:07:17 2015
@@ -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>
const T& min(const T&, const T&); // expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long')}}
@@ -94,8 +96,11 @@ namespace PR15673 {
struct a_trait : std::false_type {};
template<typename T,
- typename Requires = typename std::enable_if<a_trait<T>::value>::type> // expected-warning {{C++11 extension}}
- // expected-note at -1 {{candidate template ignored: disabled by 'enable_if' [with T = int]}}
+ typename Requires = typename std::enable_if<a_trait<T>::value>::type>
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{default template arguments for a function template are a C++11 extension}}
+#endif
+ // expected-note at -4 {{candidate template ignored: disabled by 'enable_if' [with T = int]}}
void foo() {}
void bar() { foo<int>(); } // expected-error {{no matching function for call to 'foo'}}
@@ -108,7 +113,10 @@ namespace PR15673 {
struct a_pony : std::enable_if<some_trait<T>::value> {};
template<typename T,
- typename Requires = typename a_pony<T>::type> // expected-warning {{C++11 extension}}
+ typename Requires = typename a_pony<T>::type>
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{default template arguments for a function template are a C++11 extension}}
+#endif
// FIXME: The source location here is poor.
void baz() { } // expected-note {{candidate template ignored: substitution failure [with T = int]: no type named 'type' in 'PR15673::a_pony<int>'}}
void quux() { baz<int>(); } // expected-error {{no matching function for call to 'baz'}}
@@ -116,11 +124,17 @@ namespace PR15673 {
// FIXME: This note doesn't make it clear which candidate we rejected.
template <typename T>
- using unicorns = typename std::enable_if<some_trait<T>::value>::type; // expected-warning {{C++11 extension}}
- // expected-note at -1 {{candidate template ignored: disabled by 'enable_if' [with T = int]}}
+ using unicorns = typename std::enable_if<some_trait<T>::value>::type;
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{alias declarations are a C++11 extension}}
+#endif
+ // expected-note at -4 {{candidate template ignored: disabled by 'enable_if' [with T = int]}}
template<typename T,
- typename Requires = unicorns<T> > // expected-warning {{C++11 extension}}
+ typename Requires = unicorns<T> >
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{default template arguments for a function template are a C++11 extension}}
+#endif
void wibble() {}
void wobble() { wibble<int>(); } // expected-error {{no matching function for call to 'wibble'}}
}
Modified: cfe/trunk/test/SemaTemplate/partial-spec-instantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/partial-spec-instantiate.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/partial-spec-instantiate.cpp (original)
+++ cfe/trunk/test/SemaTemplate/partial-spec-instantiate.cpp Wed Dec 9 19:07:17 2015
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only %s
+// 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
// PR4607
template <class T> struct X {};
@@ -47,4 +49,9 @@ namespace rdar9169404 {
};
X<bool, -1>::type value;
+#if __cplusplus >= 201103L
+ // expected-error at -2 {{non-type template argument evaluates to -1, which cannot be narrowed to type 'bool'}}
+#else
+ // expected-no-diagnostics
+#endif
}
Modified: cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg_template.cpp?rev=255196&r1=255195&r2=255196&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg_template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg_template.cpp Wed Dec 9 19:07:17 2015
@@ -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<template<typename T> class X> struct A; // expected-note 2{{previous template template parameter is here}}
@@ -31,7 +33,10 @@ template<typename T> void f(int);
A<f> *a9; // expected-error{{must be a class template}}
// Evil digraph '<:' is parsed as '[', expect error.
-A<::N::Z> *a10; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+A<::N::Z> *a10;
+#if __cplusplus <= 199711L
+// expected-error at -2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+#endif
// Do not do a digraph correction here.
A<: :N::Z> *a11; // expected-error{{expected expression}} \
@@ -56,16 +61,28 @@ namespace N {
}
// PR12179
-template <typename Primitive, template <Primitive...> class F> // expected-warning {{variadic templates are a C++11 extension}}
+template <typename Primitive, template <Primitive...> class F>
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{variadic templates are a C++11 extension}}
+#endif
+
struct unbox_args {
typedef typename Primitive::template call<F> x;
};
-template <template <typename> class... Templates> // expected-warning {{variadic templates are a C++11 extension}}
+template <template <typename> class... Templates>
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{variadic templates are a C++11 extension}}
+#endif
+
struct template_tuple {};
template <typename T>
struct identity {};
-template <template <typename> class... Templates> // expected-warning {{variadic templates are a C++11 extension}}
+template <template <typename> class... Templates>
+#if __cplusplus <= 199711L
+// expected-warning at -2 {{variadic templates are a C++11 extension}}
+#endif
+
template_tuple<Templates...> f7() {}
void foo() {
More information about the cfe-commits
mailing list