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