From: Charles Li Date: Tue, 17 Nov 2015 20:25:05 +0000 (+0000) Subject: [Lit Test] Updated 34 Lit tests to be C++11 compatible. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c4156ea486fd254aef7b5c0aafbee612ce0ca72;p=clang [Lit Test] Updated 34 Lit tests to be C++11 compatible. Added expected diagnostics new to C++11. Expanded RUN line to: default, C++98/03 and C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253371 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp index 32dd75ad49..2292fc540c 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp @@ -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 A { class A { @@ -20,6 +22,9 @@ namespace D { namespace C { class C {}; // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'B::B' to 'const C::C &' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'B::B' to 'C::C &&' for 1st argument}} +#endif void func(C); // expected-note {{'C::func' declared here}} \ // expected-note {{passing argument to parameter here}} C operator+(C,C); diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp index 7918e9f861..ed6c6c0bcc 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp @@ -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 Ints { int zero = 0; // expected-note {{candidate found by name lookup is 'Ints::zero'}} @@ -31,7 +33,11 @@ void test() { } namespace Numbers { - struct Number { // expected-note 2 {{candidate}} + struct Number { // expected-note 2 {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-2 2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + explicit Number(double d) : d(d) {} double d; }; @@ -66,7 +72,11 @@ void test3() { namespace inline_ns { int x; // expected-note 2{{found}} - inline namespace A { // expected-warning {{C++11}} + inline namespace A { +#if __cplusplus <= 199711L // C++03 or earlier + // expected-warning@-2 {{inline namespaces are a C++11 feature}} +#endif + int x; // expected-note 2{{found}} int y; // expected-note 2{{found}} } diff --git a/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp b/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp index 1d2b525da4..bf8df1abee 100644 --- a/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp +++ b/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp @@ -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 // rdar4641403 namespace N { @@ -34,7 +36,10 @@ namespace PR17731 { struct S c = b; } { - struct S { S() {} }; // expected-note {{candidate}} + struct S { S() {} }; // expected-note {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif int a = S(); // expected-error {{no viable conversion from 'S'}} struct S c = b; // expected-error {{no viable conversion from 'struct S'}} } @@ -50,7 +55,10 @@ namespace PR17731 { struct S c = b; } { - struct S { S() {} }; // expected-note {{candidate}} + struct S { S() {} }; // expected-note {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif int a = S(); // expected-error {{no viable conversion from 'S'}} struct S c = b; // expected-error {{no viable conversion from 'struct S'}} } diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp index bf30ee74a5..021c25016c 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp @@ -1,10 +1,15 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // We have to avoid ADL for this test. template class test {}; -class foo {}; // expected-note {{candidate}} +class foo {}; // expected-note {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif test<0> foo(foo); // expected-note {{candidate}} namespace Test0 { diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp index 44cc5a7cfa..0b7a902f93 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp @@ -1,26 +1,58 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++0x-compat %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 // The auto or register specifiers can be applied only to names of objects // declared in a block (6.3) or to function parameters (8.4). auto int ao; // expected-error {{illegal storage class on file-scoped variable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +#endif + auto void af(); // expected-error {{illegal storage class on function}} +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +#endif register int ro; // expected-error {{illegal storage class on file-scoped variable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'register' storage class specifier is deprecated}} +#endif + register void rf(); // expected-error {{illegal storage class on function}} struct S { auto int ao; // expected-error {{storage class specified for a member declaration}} +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +#endif auto void af(); // expected-error {{storage class specified for a member declaration}} +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +#endif register int ro; // expected-error {{storage class specified for a member declaration}} register void rf(); // expected-error {{storage class specified for a member declaration}} }; void foo(auto int ap, register int rp) { +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +#endif auto int abo; +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +#endif auto void abf(); // expected-error {{illegal storage class on function}} +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +#endif register int rbo; +#if __cplusplus >= 201103L // C++11 or later +// expected-warning@-2 {{'register' storage class specifier is deprecated}} +#endif + register void rbf(); // expected-error {{illegal storage class on function}} } diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp index cb62874b40..3822122697 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp @@ -1,7 +1,12 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct Base { }; struct Derived : Base { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif struct Unrelated { }; struct Derived2 : Base { }; struct Diamond : Derived, Derived2 { }; diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp index 9fc4a5809f..86b2690860 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp @@ -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 // Test instantiation of static data members declared out-of-line. @@ -15,6 +17,9 @@ struct InitOkay { }; struct CannotInit { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif int &returnInt() { return X::value; } float &returnFloat() { return X::value; } diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp index b0305dd756..215f48d9d8 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp @@ -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 struct X0 { @@ -13,6 +15,9 @@ struct X1 { }; struct X2 { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif int& get_int() { return X0::value; } X1& get_X1() { return X0::value; } diff --git a/test/CXX/temp/temp.param/p3.cpp b/test/CXX/temp/temp.param/p3.cpp index dc40c4bb90..c3c93396cb 100644 --- a/test/CXX/temp/temp.param/p3.cpp +++ b/test/CXX/temp/temp.param/p3.cpp @@ -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 // A type-parameter defines its identifier to be a type-name (if // declared with class or typename) or template-name (if declared with @@ -16,6 +18,10 @@ template class Y> struct X1 { // type-parameter (because its identifier is the name of an already // existing class) is taken as a type-parameter. For example, class T { /* ... */ }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + int i; template struct X2 { diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1.cpp index b42633924e..5a77d27d5a 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p1.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p1.cpp @@ -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 C { }; @@ -49,6 +51,9 @@ template void X1::f<>(int&, int*); // expected-note{{instantiation}} // Explicitly instantiate members of a class template struct Incomplete; // expected-note{{forward declaration}} struct NonDefaultConstructible { // expected-note{{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif NonDefaultConstructible(int); // expected-note{{candidate constructor}} }; diff --git a/test/OpenMP/for_reduction_messages.cpp b/test/OpenMP/for_reduction_messages.cpp index 05368f1a75..317f88ce11 100644 --- a/test/OpenMP/for_reduction_messages.cpp +++ b/test/OpenMP/for_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 150 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 150 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 150 -o - %s void foo() { } @@ -54,6 +56,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable: no known conversion from 'int' to 'S6' for 1st argument}} +#endif int a; public: diff --git a/test/OpenMP/for_simd_reduction_messages.cpp b/test/OpenMP/for_simd_reduction_messages.cpp index efa97c5eae..000960fb55 100644 --- a/test/OpenMP/for_simd_reduction_messages.cpp +++ b/test/OpenMP/for_simd_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/OpenMP/parallel_for_reduction_messages.cpp b/test/OpenMP/parallel_for_reduction_messages.cpp index 74808fcb30..d64577795e 100644 --- a/test/OpenMP/parallel_for_reduction_messages.cpp +++ b/test/OpenMP/parallel_for_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 100 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/OpenMP/parallel_for_simd_reduction_messages.cpp b/test/OpenMP/parallel_for_simd_reduction_messages.cpp index 480f103ef5..f402e74720 100644 --- a/test/OpenMP/parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/parallel_for_simd_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -o - %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/OpenMP/parallel_reduction_messages.cpp b/test/OpenMP/parallel_reduction_messages.cpp index 9439fed72c..174924cc81 100644 --- a/test/OpenMP/parallel_reduction_messages.cpp +++ b/test/OpenMP/parallel_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 100 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/OpenMP/parallel_sections_reduction_messages.cpp b/test/OpenMP/parallel_sections_reduction_messages.cpp index ccf67419f9..70f4a8cc2a 100644 --- a/test/OpenMP/parallel_sections_reduction_messages.cpp +++ b/test/OpenMP/parallel_sections_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 100 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/OpenMP/sections_reduction_messages.cpp b/test/OpenMP/sections_reduction_messages.cpp index 561c45ef29..79473d4e5d 100644 --- a/test/OpenMP/sections_reduction_messages.cpp +++ b/test/OpenMP/sections_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 150 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 150 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 150 -o - %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/OpenMP/simd_reduction_messages.cpp b/test/OpenMP/simd_reduction_messages.cpp index 82a966cd3f..e082921cf3 100644 --- a/test/OpenMP/simd_reduction_messages.cpp +++ b/test/OpenMP/simd_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/OpenMP/teams_reduction_messages.cpp b/test/OpenMP/teams_reduction_messages.cpp index 260cb33201..5fb43668f3 100644 --- a/test/OpenMP/teams_reduction_messages.cpp +++ b/test/OpenMP/teams_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -o - %s void foo() { } @@ -55,6 +57,9 @@ public: S5(int v) : a(v) {} }; class S6 { // expected-note 2 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate function (the implicit move assignment operator) not viable}} +#endif int a; public: diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp index e3ab610da7..c5de33cedb 100644 --- a/test/SemaCXX/constructor-initializer.cpp +++ b/test/SemaCXX/constructor-initializer.cpp @@ -1,4 +1,7 @@ // RUN: %clang_cc1 -Wreorder -fsyntax-only -verify %s +// RUN: %clang_cc1 -Wreorder -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -Wreorder -fsyntax-only -verify -std=c++11 %s + class A { int m; public: @@ -98,9 +101,11 @@ struct Current : Derived { // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}} }; -struct M { // expected-note 2 {{candidate constructor (the implicit copy constructor)}} \ - // expected-note {{declared here}} \ - // expected-note {{declared here}} +struct M { // expected-note 2 {{candidate constructor (the implicit copy constructor)}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate constructor (the implicit move constructor) not viable}} +#endif +// expected-note@-4 2 {{'M' declared here}} M(int i, int j); // expected-note 2 {{candidate constructor}} }; @@ -233,7 +238,13 @@ namespace PR7402 { // : don't crash. // Lots of questionable recovery here; errors can change. namespace test3 { - class A : public std::exception {}; // expected-error {{undeclared identifier}} expected-error {{expected class name}} expected-note 2 {{candidate}} + class A : public std::exception {}; // expected-error {{undeclared identifier}} expected-error {{expected class name}} + // expected-note@-1 {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-3 {{candidate constructor (the implicit move constructor) not viable}} +#endif + // expected-note@-5 {{candidate constructor (the implicit default constructor) not viable}} + class B : public A { public: B(const String& s, int e=0) // expected-error {{unknown type name}} diff --git a/test/SemaCXX/converting-constructor.cpp b/test/SemaCXX/converting-constructor.cpp index 1688e51e73..75002fa585 100644 --- a/test/SemaCXX/converting-constructor.cpp +++ b/test/SemaCXX/converting-constructor.cpp @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %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 + class Z { }; class Y { @@ -28,6 +31,10 @@ public: }; class FromShortExplicitly { // expected-note{{candidate constructor (the implicit copy constructor)}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + public: explicit FromShortExplicitly(short s); }; diff --git a/test/SemaCXX/crashes.cpp b/test/SemaCXX/crashes.cpp index 12251bba95..926d13ab45 100644 --- a/test/SemaCXX/crashes.cpp +++ b/test/SemaCXX/crashes.cpp @@ -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 class allocator; @@ -31,7 +33,11 @@ template struct a : T { namespace rdar8605381 { struct X {}; -struct Y { // expected-note{{candidate}} +struct Y { // expected-note{{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + Y(); }; diff --git a/test/SemaCXX/default1.cpp b/test/SemaCXX/default1.cpp index 6001001b11..fcaa2c839d 100644 --- a/test/SemaCXX/default1.cpp +++ b/test/SemaCXX/default1.cpp @@ -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 + void f(int i); void f(int i = 0); // expected-note {{previous definition is here}} void f(int i = 17); // expected-error {{redefinition of default argument}} @@ -23,7 +26,11 @@ struct X { void j(X x = 17); // expected-note{{'::j' declared here}} -struct Y { // expected-note 2{{candidate}} +struct Y { // expected-note 2{{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + explicit Y(int); }; diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp index a7899c75e4..947622c4e3 100644 --- a/test/SemaCXX/direct-initializer.cpp +++ b/test/SemaCXX/direct-initializer.cpp @@ -1,4 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %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 int x(1); int (x2)(1); @@ -14,6 +16,10 @@ public: explicit Y(float); }; class X { // expected-note{{candidate constructor (the implicit copy constructor)}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + public: explicit X(int); // expected-note{{candidate constructor}} X(float, float, float); // expected-note{{candidate constructor}} @@ -21,6 +27,10 @@ public: }; class Z { // expected-note{{candidate constructor (the implicit copy constructor)}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + public: Z(int); // expected-note{{candidate constructor}} }; diff --git a/test/SemaCXX/expressions.cpp b/test/SemaCXX/expressions.cpp index 1a50c99c59..5a0d6dd067 100644 --- a/test/SemaCXX/expressions.cpp +++ b/test/SemaCXX/expressions.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion -std=c++11 %s void choice(int); int choice(bool); @@ -12,6 +14,9 @@ void test() { void f0() { extern void f0_1(int*); register int x; +#if __cplusplus >= 201103L // C++11 or later + // expected-warning@-2 {{'register' storage class specifier is deprecated}} +#endif f0_1(&x); } diff --git a/test/SemaCXX/namespace.cpp b/test/SemaCXX/namespace.cpp index d47b7076ce..e2c1516ac3 100644 --- a/test/SemaCXX/namespace.cpp +++ b/test/SemaCXX/namespace.cpp @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %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 + namespace A { // expected-note 2 {{previous definition is here}} int A; void f() { A = 0; } @@ -8,8 +11,11 @@ void f() { A = 0; } // expected-error {{unexpected namespace name 'A': expected int A; // expected-error {{redefinition of 'A' as different kind of symbol}} class A; // expected-error {{redefinition of 'A' as different kind of symbol}} -class B {}; // expected-note {{previous definition is here}} \ - // expected-note{{candidate function (the implicit copy assignment operator)}} +class B {}; // expected-note {{previous definition is here}} +// expected-note@-1 {{candidate function (the implicit copy assignment operator) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-3 {{candidate function (the implicit move assignment operator) not viable}} +#endif void C(); // expected-note {{previous definition is here}} namespace C {} // expected-error {{redefinition of 'C' as different kind of symbol}} diff --git a/test/SemaCXX/overload-call-copycon.cpp b/test/SemaCXX/overload-call-copycon.cpp index 6720cb6953..84971024ac 100644 --- a/test/SemaCXX/overload-call-copycon.cpp +++ b/test/SemaCXX/overload-call-copycon.cpp @@ -1,6 +1,12 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs -class X { }; // expected-note {{the implicit copy constructor}} \ - // expected-note{{the implicit default constructor}} +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wnon-pod-varargs +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wnon-pod-varargs + +class X { }; // expected-note {{the implicit copy constructor}} +// expected-note@-1 {{the implicit default constructor}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-3 {{candidate constructor (the implicit move constructor) not viable}} +#endif int& copycon(X x); // expected-note{{passing argument to parameter}} float& copycon(...); diff --git a/test/SemaCXX/overloaded-builtin-operators.cpp b/test/SemaCXX/overloaded-builtin-operators.cpp index 7899403e2c..4c2953b0b3 100644 --- a/test/SemaCXX/overloaded-builtin-operators.cpp +++ b/test/SemaCXX/overloaded-builtin-operators.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -fshow-overloads=best -verify -triple x86_64-linux-gnu %s +// RUN: %clang_cc1 -fsyntax-only -fshow-overloads=best -verify -triple x86_64-linux-gnu -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -fshow-overloads=best -verify -triple x86_64-linux-gnu -std=c++11 %s struct yes; struct no; @@ -60,7 +62,10 @@ void f(Short s, Long l, Enum1 e1, Enum2 e2, Xpmf pmf) { // FIXME: should pass (void)static_cast(islong(e1 % e2)); } -struct ShortRef { // expected-note{{candidate function (the implicit copy assignment operator)}} +struct ShortRef { // expected-note{{candidate function (the implicit copy assignment operator) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate function (the implicit move assignment operator) not viable}} +#endif operator short&(); }; @@ -68,7 +73,10 @@ struct LongRef { operator volatile long&(); }; -struct XpmfRef { // expected-note{{candidate function (the implicit copy assignment operator)}} +struct XpmfRef { // expected-note{{candidate function (the implicit copy assignment operator) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate function (the implicit move assignment operator) not viable}} +#endif operator pmf&(); }; diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp index bcd7fedb4d..9b272444a2 100644 --- a/test/SemaCXX/vector.cpp +++ b/test/SemaCXX/vector.cpp @@ -1,4 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++11 %s + typedef char char16 __attribute__ ((__vector_size__ (16))); typedef long long longlong16 __attribute__ ((__vector_size__ (16))); typedef char char16_e __attribute__ ((__ext_vector_type__ (16))); @@ -101,7 +104,10 @@ void casts(longlong16 ll16, longlong16_e ll16e) { } template -struct convertible_to { // expected-note 3 {{candidate function (the implicit copy assignment operator)}} +struct convertible_to { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}} +#endif operator T() const; }; diff --git a/test/SemaTemplate/class-template-ctor-initializer.cpp b/test/SemaTemplate/class-template-ctor-initializer.cpp index 6043327b7b..6dae207745 100644 --- a/test/SemaTemplate/class-template-ctor-initializer.cpp +++ b/test/SemaTemplate/class-template-ctor-initializer.cpp @@ -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 struct A {}; @@ -55,7 +57,11 @@ namespace PR7259 { } namespace NonDependentError { - struct Base { Base(int); }; // expected-note 2{{candidate}} + struct Base { Base(int); }; // expected-note {{candidate constructor not viable}} +// expected-note@-1 {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-3 {{candidate constructor (the implicit move constructor) not viable}} +#endif template struct Derived1 : Base { diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp index c5306a6e32..ee8475b3cd 100644 --- a/test/SemaTemplate/constructor-template.cpp +++ b/test/SemaTemplate/constructor-template.cpp @@ -1,5 +1,11 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -struct X0 { // expected-note{{candidate}} +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +struct X0 { // expected-note {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} +#endif X0(int); // expected-note{{candidate}} template X0(T); // expected-note {{candidate}} template X0(T*, U*); // expected-note {{candidate}} diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp index 14b072a1a5..438f5b1aa9 100644 --- a/test/SemaTemplate/default-expr-arguments.cpp +++ b/test/SemaTemplate/default-expr-arguments.cpp @@ -1,4 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + template class C { C(int a0 = 0); }; @@ -6,6 +9,9 @@ template<> C::C(int a0); struct S { }; // expected-note 3 {{candidate constructor (the implicit copy constructor)}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 3 {{candidate constructor (the implicit move constructor) not viable}} +#endif template void f1(T a, T b = 10) { } // expected-error{{no viable conversion}} \ // expected-note{{passing argument to parameter 'b' here}} @@ -67,7 +73,10 @@ void test_x0(X0 xi) { xi.f(17); } -struct NotDefaultConstructible { // expected-note 2{{candidate}} +struct NotDefaultConstructible { // expected-note 2 {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 2 {{candidate constructor (the implicit move constructor) not viable}} +#endif NotDefaultConstructible(int); // expected-note 2{{candidate}} }; diff --git a/test/SemaTemplate/fun-template-def.cpp b/test/SemaTemplate/fun-template-def.cpp index 2d515b4b15..037747d35c 100644 --- a/test/SemaTemplate/fun-template-def.cpp +++ b/test/SemaTemplate/fun-template-def.cpp @@ -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 // Tests that dependent expressions are always allowed, whereas non-dependent // are checked as usual. @@ -9,6 +11,9 @@ namespace std { class type_info {}; } struct dummy {}; // expected-note 3 {{candidate constructor (the implicit copy constructor)}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 3 {{candidate constructor (the implicit move constructor) not viable}} +#endif template int f0(T x) { diff --git a/test/SemaTemplate/qualified-names-diag.cpp b/test/SemaTemplate/qualified-names-diag.cpp index b2df47bfff..06b94926c7 100644 --- a/test/SemaTemplate/qualified-names-diag.cpp +++ b/test/SemaTemplate/qualified-names-diag.cpp @@ -1,7 +1,12 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s namespace std { - template class vector { }; // expected-note{{candidate}} + template class vector { }; // expected-note{{candidate function (the implicit copy assignment operator) not viable}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-2 {{candidate function (the implicit move assignment operator) not viable}} +#endif } typedef int INT;