diff options
Diffstat (limited to 'test/CXX')
156 files changed, 754 insertions, 95 deletions
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp index f650ad5..eda869b 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace N1 { struct X { }; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp index f5ad68b..df9a2cd 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp @@ -108,3 +108,27 @@ namespace test6 { test6_function(args); } } + +// PR13682: we might need to instantiate class temploids. +namespace test7 { + namespace inner { + class A {}; + void test7_function(A &); + } + template <class T> class B : public inner::A {}; + + void test(B<int> &ref) { + test7_function(ref); + } +} + +// Like test7, but ensure we don't complain if the type is properly +// incomplete. +namespace test8 { + template <class T> class B; + void test8_function(B<int> &); + + void test(B<int> &ref) { + test8_function(ref); + } +} diff --git a/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp index cd7e669..ef4243e 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // C++0x [basic.lookup.classref]p3: // If the unqualified-id is ~type-name, the type-name is looked up in the diff --git a/test/CXX/basic/basic.lookup/basic.lookup.classref/p4-cxx11.cpp b/test/CXX/basic/basic.lookup/basic.lookup.classref/p4-cxx11.cpp index 7925454..a4721d6 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.classref/p4-cxx11.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.classref/p4-cxx11.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -verify +// expected-no-diagnostics struct A { void f(); }; struct C { void f(); }; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp index dc0f8b4..1060f61 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // This is basically paraphrased from the standard. diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp index 38eccfa..7c292d5 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace A { int a; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp b/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp index ab0dc24..91f5a54 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // When looking up a namespace-name in a using-directive or // namespace-alias-definition, only namespace names are considered. diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp index 878ff07..6bf74c1 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics struct S {}; S E0; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp index 58d7ff4..ba34571 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics struct S { static const int f0 = 0; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp index 0fa4f65..4ffe538 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // C++0x [basic.lookup.unqual]p14: // If a variable member of a namespace is defined outside of the diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp index 20a7ae0..abcc6ee 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics typedef int f; diff --git a/test/CXX/basic/basic.scope/basic.scope.local/p2.cpp b/test/CXX/basic/basic.scope/basic.scope.local/p2.cpp new file mode 100644 index 0000000..91e96b6 --- /dev/null +++ b/test/CXX/basic/basic.scope/basic.scope.local/p2.cpp @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -fexceptions -verify %s + +void func1(int i) { // expected-note{{previous definition is here}} + int i; // expected-error{{redefinition of 'i'}} +} + +void func2(int i) try { // expected-note{{previous definition is here}} + int i; // expected-error{{redefinition of 'i'}} +} catch (...) { +} + +void func3(int i) try { // FIXME: note {{previous definition is here}} +} catch (int i) { // FIXME: error {{redefinition of 'i'}} +} + +void func4(int i) try { // expected-note{{previous definition is here}} +} catch (...) { + int i; // expected-error{{redefinition of 'i'}} +} + +void func5() try { + int i; +} catch (...) { + int j = i; // expected-error{{use of undeclared identifier 'i'}} +} + +void func6() try { +} catch (int i) { // expected-note{{previous definition is here}} + int i; // expected-error{{redefinition of 'i'}} +} + +void func7() { + try { + } catch (int i) { // expected-note{{previous definition is here}} + int i; // expected-error{{redefinition of 'i'}} + } +} diff --git a/test/CXX/basic/basic.scope/basic.scope.pdecl/p9.cpp b/test/CXX/basic/basic.scope/basic.scope.pdecl/p9.cpp index e64b675..c627535 100644 --- a/test/CXX/basic/basic.scope/basic.scope.pdecl/p9.cpp +++ b/test/CXX/basic/basic.scope/basic.scope.pdecl/p9.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // Template type parameters. typedef unsigned char T; diff --git a/test/CXX/basic/basic.start/basic.start.main/p2a.cpp b/test/CXX/basic/basic.start/basic.start.main/p2a.cpp index b8dfbe7..b27d492 100644 --- a/test/CXX/basic/basic.start/basic.start.main/p2a.cpp +++ b/test/CXX/basic/basic.start/basic.start.main/p2a.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics typedef int Int; typedef char Char; diff --git a/test/CXX/basic/basic.start/basic.start.main/p2b.cpp b/test/CXX/basic/basic.start/basic.start.main/p2b.cpp index 785382c..65cd202 100644 --- a/test/CXX/basic/basic.start/basic.start.main/p2b.cpp +++ b/test/CXX/basic/basic.start/basic.start.main/p2b.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics typedef int Int; typedef char Char; diff --git a/test/CXX/basic/basic.start/basic.start.main/p2c.cpp b/test/CXX/basic/basic.start/basic.start.main/p2c.cpp index 81b08b9..2b082ec 100644 --- a/test/CXX/basic/basic.start/basic.start.main/p2c.cpp +++ b/test/CXX/basic/basic.start/basic.start.main/p2c.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics int main() { } diff --git a/test/CXX/basic/basic.start/basic.start.main/p2g.cpp b/test/CXX/basic/basic.start/basic.start.main/p2g.cpp index e3209fd..45f643f 100644 --- a/test/CXX/basic/basic.start/basic.start.main/p2g.cpp +++ b/test/CXX/basic/basic.start/basic.start.main/p2g.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics int main(int argc, const char* const* argv) { } diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp index 6cd587c..9a740df 100644 --- a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp +++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics int *use_new(int N) { return new int [N]; diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp index 4567c46..9819ea0 100644 --- a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp +++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace std { class bad_alloc { }; diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp index 7cb192b..19d94cf 100644 --- a/test/CXX/class.access/class.friend/p1.cpp +++ b/test/CXX/class.access/class.friend/p1.cpp @@ -20,7 +20,7 @@ void test1() { g()->f(); S::f(); X::g(); // expected-error{{no member named 'g' in 'X'}} - X::S x_s; // expected-error{{no member named 'S' in 'X'}} + X::S x_s; // expected-error{{no type named 'S' in 'X'}} X x; x.g(); // expected-error{{no member named 'g' in 'X'}} } @@ -44,16 +44,16 @@ namespace N { S s; S::f(); X::g(); // expected-error{{no member named 'g' in 'N::X'}} - X::S x_s; // expected-error{{no member named 'S' in 'N::X'}} + X::S x_s; // expected-error{{no type named 'S' in 'N::X'}} X x; x.g(); // expected-error{{no member named 'g' in 'N::X'}} g2(); S2 s2; ::g2(); // expected-error{{no member named 'g2' in the global namespace}} - ::S2 g_s2; // expected-error{{no member named 'S2' in the global namespace}} + ::S2 g_s2; // expected-error{{no type named 'S2' in the global namespace}} X::g2(); // expected-error{{no member named 'g2' in 'N::X'}} - X::S2 x_s2; // expected-error{{no member named 'S2' in 'N::X'}} + X::S2 x_s2; // expected-error{{no type named 'S2' in 'N::X'}} x.g2(); // expected-error{{no member named 'g2' in 'N::X'}} } } @@ -356,3 +356,19 @@ namespace PR9103 { } }; } + +// PR13642. When computing the effective context, we were walking up +// the DC chain for the canonical decl, which is unfortunate if that's +// (e.g.) a friend declaration. +namespace test14 { + class A { + class B { // expected-note {{implicitly declared private here}} + static int i; + friend void c(); + }; + }; + + void c() { + A::B::i = 5; // expected-error {{'B' is a private member of 'test14::A'}} + } +} diff --git a/test/CXX/class.access/class.friend/p3-cxx0x.cpp b/test/CXX/class.access/class.friend/p3-cxx0x.cpp index 00fc0a3..e4d5fd5 100644 --- a/test/CXX/class.access/class.friend/p3-cxx0x.cpp +++ b/test/CXX/class.access/class.friend/p3-cxx0x.cpp @@ -27,3 +27,29 @@ struct Y3 { X1<Y2> x1a; X1<Y3> x1b; X1<Y1> x1c; // expected-note{{in instantiation of template class 'X1<Y1>' requested here}} + +template<typename T> +class A { + T x; +public: + class foo {}; + static int y; +}; + +struct { + // Ill-formed + int friend; // expected-error {{'friend' must appear first in a non-function declaration}} + unsigned friend int; // expected-error {{'friend' must appear first in a non-function declaration}} + const volatile friend int; // expected-error {{'friend' must appear first in a non-function declaration}} + int + friend; // expected-error {{'friend' must appear first in a non-function declaration}} + + // OK + int friend foo(void); + friend int; + friend const volatile int; + friend + + float; + template<typename T> friend class A<T>::foo; +} a; diff --git a/test/CXX/class.access/class.protected/p1-cxx11.cpp b/test/CXX/class.access/class.protected/p1-cxx11.cpp index dc9b20d..c1cf047 100644 --- a/test/CXX/class.access/class.protected/p1-cxx11.cpp +++ b/test/CXX/class.access/class.protected/p1-cxx11.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // PR12497 namespace test0 { diff --git a/test/CXX/class.access/class.protected/p1.cpp b/test/CXX/class.access/class.protected/p1.cpp index c9491e1..132ff61 100644 --- a/test/CXX/class.access/class.protected/p1.cpp +++ b/test/CXX/class.access/class.protected/p1.cpp @@ -423,7 +423,7 @@ namespace test12 { // This friendship is not considered because a public member of A is // inaccessible in C. namespace test13 { - class A { protected: int foo(); }; // expected-note {{can only access this member on an object of type}} + class A { protected: int foo(); }; // expected-note {{declared protected here}} class B : private virtual A {}; class C : private B { friend void test(); }; class D : public virtual A {}; diff --git a/test/CXX/class.derived/class.abstract/p16.cpp b/test/CXX/class.derived/class.abstract/p16.cpp new file mode 100644 index 0000000..93f905c --- /dev/null +++ b/test/CXX/class.derived/class.abstract/p16.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +struct A { + virtual void a(); // expected-note{{overridden virtual function is here}} + virtual void b() = delete; // expected-note{{overridden virtual function is here}} +}; + +struct B: A { + virtual void a() = delete; // expected-error{{deleted function 'a' cannot override a non-deleted function}} + virtual void b(); // expected-error{{non-deleted function 'b' cannot override a deleted function}} +}; + +struct C: A { + virtual void a(); + virtual void b() = delete; +}; diff --git a/test/CXX/class.derived/p2.cpp b/test/CXX/class.derived/p2.cpp index 7ef53d3..87e0f74 100644 --- a/test/CXX/class.derived/p2.cpp +++ b/test/CXX/class.derived/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify +// expected-no-diagnostics // "During the lookup for a base class name, non-type names are ignored" namespace PR5840 { diff --git a/test/CXX/class/class.friend/p1-ambiguous.cpp b/test/CXX/class/class.friend/p1-ambiguous.cpp index a9dca4f..3bb3271 100644 --- a/test/CXX/class/class.friend/p1-ambiguous.cpp +++ b/test/CXX/class/class.friend/p1-ambiguous.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // Make sure that friend declarations don't introduce ambiguous // declarations. diff --git a/test/CXX/class/class.friend/p1-cxx11.cpp b/test/CXX/class/class.friend/p1-cxx11.cpp index 235f295..6e3d850 100644 --- a/test/CXX/class/class.friend/p1-cxx11.cpp +++ b/test/CXX/class/class.friend/p1-cxx11.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics class A { class AInner { diff --git a/test/CXX/class/class.nest/p3.cpp b/test/CXX/class/class.nest/p3.cpp index c4c4ca7..677411f 100644 --- a/test/CXX/class/class.nest/p3.cpp +++ b/test/CXX/class/class.nest/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // C++0x [class.nest] p3: // If class X is defined in a namespace scope, a nested class Y may be diff --git a/test/CXX/class/p1-0x.cpp b/test/CXX/class/p1-0x.cpp index be5fdff..5c32788 100644 --- a/test/CXX/class/p1-0x.cpp +++ b/test/CXX/class/p1-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// expected-no-diagnostics namespace Test1 { class A final { }; diff --git a/test/CXX/class/p2-0x.cpp b/test/CXX/class/p2-0x.cpp index dbb01e5..5b39e0a 100644 --- a/test/CXX/class/p2-0x.cpp +++ b/test/CXX/class/p2-0x.cpp @@ -26,3 +26,11 @@ struct C : A<int> { }; // expected-error {{base 'A' is marked 'final'}} } +namespace Test4 { + +struct A final { virtual void func() = 0; }; // expected-warning {{abstract class is marked 'final'}} expected-note {{unimplemented pure virtual method 'func' in 'A'}} +struct B { virtual void func() = 0; }; // expected-note {{unimplemented pure virtual method 'func' in 'C'}} + +struct C final : B { }; // expected-warning {{abstract class is marked 'final'}} + +} diff --git a/test/CXX/class/p6-0x.cpp b/test/CXX/class/p6-0x.cpp index e153b4d..cf628a6 100644 --- a/test/CXX/class/p6-0x.cpp +++ b/test/CXX/class/p6-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// expected-no-diagnostics class Trivial { int n; void f(); }; class NonTrivial1 { NonTrivial1(const NonTrivial1 &); }; diff --git a/test/CXX/conv/conv.prom/p2.cpp b/test/CXX/conv/conv.prom/p2.cpp index 8d75419..ca64cfa 100644 --- a/test/CXX/conv/conv.prom/p2.cpp +++ b/test/CXX/conv/conv.prom/p2.cpp @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -ffreestanding %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -fshort-wchar -ffreestanding %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -triple x86_64-pc-linux-gnu -ffreestanding %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -triple x86_64-pc-linux-gnu -ffreestanding -fshort-wchar %s +// expected-no-diagnostics #include <stdint.h> diff --git a/test/CXX/conv/conv.prom/p4.cpp b/test/CXX/conv/conv.prom/p4.cpp index 02a91cd..8c86d2a 100644 --- a/test/CXX/conv/conv.prom/p4.cpp +++ b/test/CXX/conv/conv.prom/p4.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// expected-no-diagnostics enum X : short { A, B }; extern decltype(+A) x; @@ -7,3 +8,21 @@ extern int x; enum Y : long { C, D }; extern decltype(+C) y; extern long y; + +// An enum with a fixed underlying type has an integral promotion to that type, +// and to its promoted type. +enum B : bool { false_, true_ }; +template<bool> struct T {}; +T<false_> f; +T<true_> t; +// FIXME: DR1407 will make this ill-formed +T<+true_> q; // desired-error {{conversion from 'int' to 'bool'}} + +enum B2 : bool { + a = false, + b = true, + c = false_, + d = true_, + // FIXME: DR1407 will make this ill-formed + e = +false_ // desired-error {{conversion from 'int' to 'bool'}} +}; diff --git a/test/CXX/conv/conv.ptr/p2.cpp b/test/CXX/conv/conv.ptr/p2.cpp index 8808d20..b761769 100644 --- a/test/CXX/conv/conv.ptr/p2.cpp +++ b/test/CXX/conv/conv.ptr/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace pr7801 { extern void* x[]; diff --git a/test/CXX/conv/conv.qual/pr6089.cpp b/test/CXX/conv/conv.qual/pr6089.cpp index ae75ec4..bfadc6c 100644 --- a/test/CXX/conv/conv.qual/pr6089.cpp +++ b/test/CXX/conv/conv.qual/pr6089.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics bool is_char_ptr( const char* ); diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp index 411c16c..943e053 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // PR8430 namespace N { diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp index 98d12f9..f923623 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp @@ -3,11 +3,11 @@ namespace NIL {} // expected-note {{previous definition}} inline namespace NIL {} // expected-error {{cannot be reopened as inline}} inline namespace IL {} // expected-note {{previous definition}} -namespace IL {} // expected-warning{{inline namespace cannot be re-opened as a non-inline namespace}} +namespace IL {} // expected-warning{{inline namespace cannot be reopened as a non-inline namespace}} namespace {} // expected-note {{previous definition}} inline namespace {} // expected-error {{cannot be reopened as inline}} namespace X { inline namespace {} // expected-note {{previous definition}} - namespace {} // expected-error {{cannot be reopened as non-inline}} + namespace {} // expected-warning {{cannot be reopened as a non-inline namespace}} } diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp index 546c4a4..ae40062 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace test0 { namespace ns0 { diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp index dd44bfc..699d80a 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // C++03 [namespace.udecl]p3: // For the purpose of overload resolution, the functions which are diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p6.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p6.cpp index 4cb91cd..2bcbe26 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p6.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p6.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // <rdar://problem/8296180> typedef int pid_t; diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p6.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p6.cpp index f9702ba..416aeb4 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p6.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p6.cpp @@ -6,7 +6,8 @@ int p[10]; void f() { int x = 42, y[5]; // FIXME: Produce a better diagnostic for this case. - int(p[[x] { return x; }()]); // expected-error {{expected ']'}} + int(p[[x] { return x; }()]); // expected-error {{expected ']'}} \ + // expected-warning {{unknown attribute 'x' ignored}} y[[] { return 2; }()] = 2; // expected-error {{consecutive left square brackets}} } diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp index fd17d35..3c1152c 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -fcxx-exceptions %s -// RUN: %clang_cc1 -fsyntax-only -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -verify -std=c++11 -fcxx-exceptions %s +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s namespace StdExample { @@ -80,7 +80,7 @@ constexpr int Conditional2(bool b, int n) { return b ? n * ng : n + ng; } // exp // __builtin_constant_p ? : is magical, and is always a potential constant. constexpr bool BcpCall(int n) { - return __builtin_constant_p((int*)n != &n) ? (int*)n != &n : (int*)n != &n; + return __builtin_constant_p((int*)n != &n) ? (int*)n != &n : (int*)n != &n; // expected-warning 3 {{cast to 'int *' from smaller integer type 'int'}} } static_assert(BcpCall(0), ""); diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp index f732255..e91cacf 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp @@ -86,3 +86,6 @@ namespace PR13293 { template void h<double>(); } #endif + +auto fail((unknown)); // expected-error{{use of undeclared identifier 'unknown'}} +int& crash = fail; diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp index 0b518bb..02cc973 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp @@ -34,7 +34,7 @@ void f() { void g() throw (struct Ex {}) { // expected-error {{'Ex' can not be defined in a type specifier}} } -int alignas(struct Aa {}) x; // expected-error {{'Aa' can not be defined in a type specifier}} +alignas(struct Aa {}) int x; // expected-error {{'Aa' can not be defined in a type specifier}} int a = sizeof(struct So {}); // expected-error {{'So' can not be defined in a type specifier}} int b = alignof(struct Ao {}); // expected-error {{'Ao' can not be defined in a type specifier}} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp index 1041571..2342807 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp @@ -16,3 +16,9 @@ void tf() { // Allowed by GNU extension int a4[] = {}; // expected-error {{zero size arrays}} + +struct Incomplete; // expected-note {{forward declaration of 'Incomplete'}} +struct A { + Incomplete i; // expected-error {{field has incomplete type 'Incomplete'}} +}; +A a[] = { 0 }; // PR13971: don't hang. diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp index 885d11b..2c9cd88 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // PR5787 class C { diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp index 20c059e..76053f0 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics int g(int); void f() { int i; diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp index 3631af1..878d2c6 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics char x1[]("hello"); extern char x1[6]; diff --git a/test/CXX/dcl.decl/dcl.init/p7.cpp b/test/CXX/dcl.decl/dcl.init/p7.cpp new file mode 100644 index 0000000..03216f4 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/p7.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +struct NotAggregateBase {}; + +struct A : NotAggregateBase { +private: + A() = default; // expected-note {{here}} +}; +A a = {}; // expected-error {{calling a private constructor}} + +struct B : NotAggregateBase { + explicit B() = default; // expected-note {{here}} +}; +B b = {}; // expected-error {{chosen constructor is explicit}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp index 0a107eb..68aabca 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics void point(int = 3, int = 4); diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp index e9c5e0c..5467a92 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp @@ -1,9 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -void nondecl(int (*f)(int x = 5)) // {expected-error {{default arguments can only be specified}}} +void nondecl(int (*f)(int x = 5)) // expected-error {{default arguments can only be specified}} { - void (*f2)(int = 17) // {expected-error {{default arguments can only be specified}}} - = (void (*)(int = 42))f; // {expected-error {{default arguments can only be specified}}} + void (*f2)(int = 17) // expected-error {{default arguments can only be specified}} + = (void (*)(int = 42))f; // expected-error {{default arguments can only be specified}} } struct X0 { diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp index 0e69521..bc249b5 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> struct identity; template<typename ...Types> struct tuple; diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp index 4ce80bc..cd623df 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T, typename U> struct is_same { diff --git a/test/CXX/dcl.decl/dcl.meaning/p1.cpp b/test/CXX/dcl.decl/dcl.meaning/p1.cpp index 3672ea0..ec9a261 100644 --- a/test/CXX/dcl.decl/dcl.meaning/p1.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/p1.cpp @@ -7,7 +7,7 @@ namespace PR8019 { struct PR8019::x { int x; }; // expected-error{{non-friend class member 'x' cannot have a qualified name}} struct inner; - struct y::inner { }; // expected-warning{{extra qualification on member 'inner'}} + struct y::inner { }; // expected-error{{extra qualification on member 'inner'}} template<typename T> struct PR8019::x2 { }; // expected-error{{non-friend class member 'x2' cannot have a qualified name}} @@ -16,7 +16,7 @@ namespace PR8019 { struct inner_template; template<typename T> - struct y::inner_template { }; // expected-warning{{extra qualification on member 'inner_template'}} + struct y::inner_template { }; // expected-error{{extra qualification on member 'inner_template'}} }; } @@ -29,9 +29,9 @@ namespace NS { template<typename T> void wibble(T); } namespace NS { - void NS::foo() {} // expected-warning{{extra qualification on member 'foo'}} - int NS::bar; // expected-warning{{extra qualification on member 'bar'}} - struct NS::X { }; // expected-warning{{extra qualification on member 'X'}} - template<typename T> struct NS::Y; // expected-warning{{extra qualification on member 'Y'}} - template<typename T> void NS::wibble(T) { } // expected-warning{{extra qualification on member 'wibble'}} + void NS::foo() {} // expected-error{{extra qualification on member 'foo'}} + int NS::bar; // expected-error{{extra qualification on member 'bar'}} + struct NS::X { }; // expected-error{{extra qualification on member 'X'}} + template<typename T> struct NS::Y; // expected-error{{extra qualification on member 'Y'}} + template<typename T> void NS::wibble(T) { } // expected-error{{extra qualification on member 'wibble'}} } diff --git a/test/CXX/dcl.decl/dcl.name/p1.cpp b/test/CXX/dcl.decl/dcl.name/p1.cpp index 9838b4f..e032a7f 100644 --- a/test/CXX/dcl.decl/dcl.name/p1.cpp +++ b/test/CXX/dcl.decl/dcl.name/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace pr6200 { struct v {}; diff --git a/test/CXX/dcl.decl/p4-0x.cpp b/test/CXX/dcl.decl/p4-0x.cpp index 98c33b2..35177a0 100644 --- a/test/CXX/dcl.decl/p4-0x.cpp +++ b/test/CXX/dcl.decl/p4-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics struct X { void f() &; diff --git a/test/CXX/except/except.spec/canonical.cpp b/test/CXX/except/except.spec/canonical.cpp index 81ca2ae..b6d3e9c 100644 --- a/test/CXX/except/except.spec/canonical.cpp +++ b/test/CXX/except/except.spec/canonical.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics // PR10087: Make sure that we don't conflate exception specifications // from different functions in the canonical type system. diff --git a/test/CXX/except/except.spec/p11.cpp b/test/CXX/except/except.spec/p11.cpp index 0e4fad5..1f6bf21 100644 --- a/test/CXX/except/except.spec/p11.cpp +++ b/test/CXX/except/except.spec/p11.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// expected-no-diagnostics // This is the "let the user shoot himself in the foot" clause. void f() noexcept { diff --git a/test/CXX/except/except.spec/p14.cpp b/test/CXX/except/except.spec/p14.cpp index 4f50afb..ff21ab8 100644 --- a/test/CXX/except/except.spec/p14.cpp +++ b/test/CXX/except/except.spec/p14.cpp @@ -63,3 +63,41 @@ namespace PR13381 { static_assert(!noexcept(X(X::val())), ""); static_assert(!noexcept(X::ref() = X::val()), ""); } + +namespace PR14141 { + // Part of DR1351: the implicit exception-specification is noexcept(false) if + // the set of potential exceptions of the special member function contains + // "any". Hence it is compatible with noexcept(false). + struct ThrowingBase { + ThrowingBase() noexcept(false); + ThrowingBase(const ThrowingBase&) noexcept(false); + ThrowingBase(ThrowingBase&&) noexcept(false); + ThrowingBase &operator=(const ThrowingBase&) noexcept(false); + ThrowingBase &operator=(ThrowingBase&&) noexcept(false); + ~ThrowingBase() noexcept(false); + }; + struct Derived : ThrowingBase { + Derived() noexcept(false) = default; + Derived(const Derived&) noexcept(false) = default; + Derived(Derived&&) noexcept(false) = default; + Derived &operator=(const Derived&) noexcept(false) = default; + Derived &operator=(Derived&&) noexcept(false) = default; + ~Derived() noexcept(false) = default; + }; + struct Derived2 : ThrowingBase { + Derived2() = default; + Derived2(const Derived2&) = default; + Derived2(Derived2&&) = default; + Derived2 &operator=(const Derived2&) = default; + Derived2 &operator=(Derived2&&) = default; + ~Derived2() = default; + }; + struct Derived3 : ThrowingBase { + Derived3() noexcept(true) = default; // expected-error {{does not match the calculated}} + Derived3(const Derived3&) noexcept(true) = default; // expected-error {{does not match the calculated}} + Derived3(Derived3&&) noexcept(true) = default; // expected-error {{does not match the calculated}} + Derived3 &operator=(const Derived3&) noexcept(true) = default; // expected-error {{does not match the calculated}} + Derived3 &operator=(Derived3&&) noexcept(true) = default; // expected-error {{does not match the calculated}} + ~Derived3() noexcept(true) = default; // expected-error {{does not match the calculated}} + }; +} diff --git a/test/CXX/except/except.spec/p15.cpp b/test/CXX/except/except.spec/p15.cpp index 110ec3fa..fcf1235 100644 --- a/test/CXX/except/except.spec/p15.cpp +++ b/test/CXX/except/except.spec/p15.cpp @@ -9,16 +9,20 @@ void f() { delete[] new int[1]; } -void operator delete(void*) noexcept; -void operator delete[](void*) noexcept; +void operator delete(void*); +void operator delete[](void*); + +static_assert(noexcept(operator delete(0)), ""); +static_assert(noexcept(operator delete[](0)), ""); // Same goes for explicit declarations. void operator delete(void*, float); -void operator delete(void*, float) noexcept; - void operator delete[](void*, float); -void operator delete[](void*, float) noexcept; + +static_assert(noexcept(operator delete(0, 0.f)), ""); +static_assert(noexcept(operator delete[](0, 0.f)), ""); // But explicit specs stay. void operator delete(void*, double) throw(int); // expected-note {{previous}} +static_assert(!noexcept(operator delete(0, 0.)), ""); void operator delete(void*, double) noexcept; // expected-error {{does not match}} diff --git a/test/CXX/except/except.spec/p4.cpp b/test/CXX/except/except.spec/p4.cpp new file mode 100644 index 0000000..1bf7018 --- /dev/null +++ b/test/CXX/except/except.spec/p4.cpp @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -std=c++11 %s -verify -fcxx-exceptions + +// We permit overriding an implicit exception specification with an explicit one +// as an extension, for compatibility with existing code. + +struct S { + void a(); // expected-note {{here}} + ~S(); // expected-note {{here}} + void operator delete(void*); // expected-note {{here}} +}; + +void S::a() noexcept {} // expected-error {{does not match previous}} +S::~S() noexcept {} // expected-warning {{function previously declared with an implicit exception specification redeclared with an explicit exception specification}} +void S::operator delete(void*) noexcept {} // expected-warning {{function previously declared with an implicit exception specification redeclared with an explicit exception specification}} + +struct T { + void a() noexcept; // expected-note {{here}} + ~T() noexcept; // expected-note {{here}} + void operator delete(void*) noexcept; // expected-note {{here}} +}; + +void T::a() {} // expected-warning {{missing exception specification 'noexcept'}} +T::~T() {} // expected-warning {{function previously declared with an explicit exception specification redeclared with an implicit exception specification}} +void T::operator delete(void*) {} // expected-warning {{function previously declared with an explicit exception specification redeclared with an implicit exception specification}} + + +// The extension does not extend to function templates. + +template<typename T> struct U { + T t; + ~U(); // expected-note {{here}} + void operator delete(void*); // expected-note {{here}} +}; + +template<typename T> U<T>::~U() noexcept(true) {} // expected-error {{exception specification in declaration does not match previous declaration}} +template<typename T> void U<T>::operator delete(void*) noexcept(false) {} // expected-error {{exception specification in declaration does not match previous declaration}} diff --git a/test/CXX/expr/expr.cast/p4-0x.cpp b/test/CXX/expr/expr.cast/p4-0x.cpp index 96bf5f9..76ac318 100644 --- a/test/CXX/expr/expr.cast/p4-0x.cpp +++ b/test/CXX/expr/expr.cast/p4-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics struct X { }; struct Y : X { }; diff --git a/test/CXX/expr/expr.const/p3-0x-nowarn.cpp b/test/CXX/expr/expr.const/p3-0x-nowarn.cpp index c891374..7d12ced 100644 --- a/test/CXX/expr/expr.const/p3-0x-nowarn.cpp +++ b/test/CXX/expr/expr.const/p3-0x-nowarn.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wno-c++11-narrowing -verify %s +// expected-no-diagnostics // <rdar://problem/11121178> void f(int x) { diff --git a/test/CXX/expr/expr.const/p5-0x.cpp b/test/CXX/expr/expr.const/p5-0x.cpp index 60fabe3..bdb2b23 100644 --- a/test/CXX/expr/expr.const/p5-0x.cpp +++ b/test/CXX/expr/expr.const/p5-0x.cpp @@ -61,10 +61,10 @@ enum NotFixed { // [dcl.align]p2: When the alignment-specifier is of the form // alignas(assignment-expression), the assignment-expression shall be an // integral constant expression -int alignas(ok) alignas1; -int alignas(incomplete) alignas2; // expected-error {{incomplete}} -int alignas(expl) alignas3; // expected-error {{explicit conversion}} -int alignas(ambig) alignas4; // expected-error {{ambiguous conversion}} +alignas(ok) int alignas1; +alignas(incomplete) int alignas2; // expected-error {{incomplete}} +alignas(expl) int alignas3; // expected-error {{explicit conversion}} +alignas(ambig) int alignas4; // expected-error {{ambiguous conversion}} // [dcl.array]p1: If the constant-expression is present, it shall be an integral // constant expression diff --git a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp index 6ba8d51..be89876 100644 --- a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp +++ b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // The result of the expression const_cast<T>(v) is of type T. If T is // an lvalue reference to object type, the result is an lvalue; if T diff --git a/test/CXX/expr/expr.post/expr.ref/p3.cpp b/test/CXX/expr/expr.post/expr.ref/p3.cpp index 98771d3..db33c01 100644 --- a/test/CXX/expr/expr.post/expr.ref/p3.cpp +++ b/test/CXX/expr/expr.post/expr.ref/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -verify -fsyntax-only %s +// expected-no-diagnostics template<typename T> struct Node { int lhs; diff --git a/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp index 9ef15e6..830ccda 100644 --- a/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp +++ b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // A glvalue of type "cv1 T1" can be cast to type "rvalue reference to // cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1" (8.5.3). diff --git a/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp index 731c508..c624c7e 100644 --- a/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp +++ b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics enum class EC { ec1 }; diff --git a/test/CXX/expr/expr.post/expr.type.conv/p1-0x.cpp b/test/CXX/expr/expr.post/expr.type.conv/p1-0x.cpp index 253744e..568c61b 100644 --- a/test/CXX/expr/expr.post/expr.type.conv/p1-0x.cpp +++ b/test/CXX/expr/expr.post/expr.type.conv/p1-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics struct foo { foo(); diff --git a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp index 030c90c..b84cec6 100644 --- a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp @@ -91,11 +91,11 @@ namespace Static { namespace PR12564 { struct Base { - void bar(Base&) {} // unexpected-note {{here}} + void bar(Base&) {} // FIXME: expected-note {{here}} }; struct Derived : Base { // FIXME: This should be accepted. - void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // unexpected-error {{cannot bind to a value of unrelated type}} + void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // expected-error {{cannot bind to a value of unrelated type}} }; } diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp index 678fa4b..6358215 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp @@ -73,3 +73,18 @@ struct ExpectedThisLayout { static_assert(sizeof(x) == sizeof(ExpectedThisLayout), "Layout mismatch!"); } }; + +struct CaptureArrayAndThis { + int value; + + void f() { + int array[3]; + [=]() -> int { + int result = value; + for (unsigned i = 0; i < 3; ++i) + result += array[i]; + return result; + }(); + } +}; + diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp index c4deba9..b4b1605 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify +// expected-no-diagnostics class NonCopyable { NonCopyable(const NonCopyable&); diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p18.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p18.cpp index 930a4b3..93c2805 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p18.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p18.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -Wunused -verify +// expected-no-diagnostics template<typename T, typename U> struct is_same { diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p20.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p20.cpp index 4487cfc..17eb841 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p20.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p20.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -Wunused -verify +// expected-no-diagnostics template<typename T> void destroy(T* ptr) { diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p21.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p21.cpp index 7139058..bc2c999 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p21.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p21.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify +// expected-no-diagnostics struct DirectInitOnly { explicit DirectInitOnly(DirectInitOnly&); diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp index b5de1a7..1f5969d 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -fms-extensions %s +// expected-no-diagnostics #define P(e) static_assert(noexcept(e), "expected nothrow") #define N(e) static_assert(!noexcept(e), "expected throw") diff --git a/test/CXX/expr/expr.unary/expr.unary.op/p3.cpp b/test/CXX/expr/expr.unary/expr.unary.op/p3.cpp index 2dd6b23..08ab0ca 100644 --- a/test/CXX/expr/expr.unary/expr.unary.op/p3.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.op/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only %s -verify +// expected-no-diagnostics namespace rdar10544564 { // Check that we don't attempt to use an overloaded operator& when diff --git a/test/CXX/expr/p8.cpp b/test/CXX/expr/p8.cpp index 2f6c094..471d1c5 100644 --- a/test/CXX/expr/p8.cpp +++ b/test/CXX/expr/p8.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics int a0; const volatile int a1 = 2; diff --git a/test/CXX/expr/p9.cpp b/test/CXX/expr/p9.cpp index 803b0cc..4c60b8b 100644 --- a/test/CXX/expr/p9.cpp +++ b/test/CXX/expr/p9.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // floating-point overloads diff --git a/test/CXX/lex/lex.literal/lex.ccon/p1.cpp b/test/CXX/lex/lex.literal/lex.ccon/p1.cpp index 5342153..f84f5fb 100644 --- a/test/CXX/lex/lex.literal/lex.ccon/p1.cpp +++ b/test/CXX/lex/lex.literal/lex.ccon/p1.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Check types of char literals extern char a; diff --git a/test/CXX/lex/lex.trigraph/p3.cpp b/test/CXX/lex/lex.trigraph/p3.cpp index 2be0328..c74d8f3 100644 --- a/test/CXX/lex/lex.trigraph/p3.cpp +++ b/test/CXX/lex/lex.trigraph/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -trigraphs -Wtrigraphs -verify %s +// expected-no-diagnostics char a[] = "?? ??\"??#??$??%??&??*??+??,??.??0??1??2??3??4??5??6" diff --git a/test/CXX/over/over.built/p1.cpp b/test/CXX/over/over.built/p1.cpp deleted file mode 100644 index 6000f5b..0000000 --- a/test/CXX/over/over.built/p1.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s - -enum E1 { one }; -enum E2 { two }; - -bool operator >= (E1, E1) { - return false; -} - -bool operator >= (E1, const E2) { - return false; -} - -bool test(E1 a, E1 b, E2 c) { - return a >= b || a >= c; -} diff --git a/test/CXX/over/over.built/p23.cpp b/test/CXX/over/over.built/p23.cpp index 4125521..a1c0d4f 100644 --- a/test/CXX/over/over.built/p23.cpp +++ b/test/CXX/over/over.built/p23.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s +// expected-no-diagnostics struct Variant { template <typename T> operator T(); diff --git a/test/CXX/over/over.built/p25.cpp b/test/CXX/over/over.built/p25.cpp index aea3854..09e550d 100644 --- a/test/CXX/over/over.built/p25.cpp +++ b/test/CXX/over/over.built/p25.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics enum class Color { Red, Green, Blue }; diff --git a/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp index 3971acc..f813305 100644 --- a/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp +++ b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics namespace std_example { int i; int f1(); diff --git a/test/CXX/over/over.match/over.match.best/p1.cpp b/test/CXX/over/over.match/over.match.best/p1.cpp index 5c315a7..59e3dac 100644 --- a/test/CXX/over/over.match/over.match.best/p1.cpp +++ b/test/CXX/over/over.match/over.match.best/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> int &f0(T*, int); float &f0(void*, int); diff --git a/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3.cpp b/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3.cpp new file mode 100644 index 0000000..35f8808 --- /dev/null +++ b/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3.cpp @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics + +// This is specifically testing the bullet: +// "do not have the same parameter-type-list as any non-template +// non-member candidate." +// The rest is sort of hard to test separately. + +enum E1 { one }; +enum E2 { two }; + +struct A; + +A operator >= (E1, E1); +A operator >= (E1, const E2); + +E1 a; +E2 b; + +extern A test1; +extern decltype(a >= a) test1; +extern decltype(a >= b) test1; + +template <typename T> A operator <= (E1, T); +extern bool test2; +extern decltype(a <= a) test2; + +extern A test3; +extern decltype(a <= b) test3;
\ No newline at end of file diff --git a/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp index 3845af0..68c7990 100644 --- a/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp +++ b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> T &lvalue(); template<typename T> T &&xvalue(); diff --git a/test/CXX/over/over.oper/over.literal/p7.cpp b/test/CXX/over/over.oper/over.literal/p7.cpp index 72411b9..74e9457 100644 --- a/test/CXX/over/over.oper/over.literal/p7.cpp +++ b/test/CXX/over/over.oper/over.literal/p7.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -verify +// expected-no-diagnostics constexpr int operator "" _a(const char *c) { return c[0]; diff --git a/test/CXX/over/over.oper/over.literal/p8.cpp b/test/CXX/over/over.oper/over.literal/p8.cpp index 3f76082..6f63610 100644 --- a/test/CXX/over/over.oper/over.literal/p8.cpp +++ b/test/CXX/over/over.oper/over.literal/p8.cpp @@ -9,11 +9,10 @@ void operator "" _km(long double); // ok string operator "" _i18n(const char*, std::size_t); // ok // FIXME: This should be accepted once we support UCNs template<char...> int operator "" \u03C0(); // ok, UCN for lowercase pi // expected-error {{expected identifier}} -float operator ""E(const char *); // expected-error {{C++11 requires a space between literal and identifier}} expected-warning {{reserved}} +float operator ""E(const char *); // expected-error {{invalid suffix on literal}} expected-warning {{reserved}} float operator " " B(const char *); // expected-error {{must be '""'}} expected-warning {{reserved}} string operator "" 5X(const char *, std::size_t); // expected-error {{expected identifier}} double operator "" _miles(double); // expected-error {{parameter}} template<char...> int operator "" j(const char*); // expected-error {{parameter}} -// FIXME: Accept this as an extension, with a fix-it to add the space -float operator ""_E(const char *); // expected-error {{C++11 requires a space between the "" and the user-defined suffix in a literal operator}} +float operator ""_E(const char *); diff --git a/test/CXX/special/class.conv/class.conv.ctor/p1.cpp b/test/CXX/special/class.conv/class.conv.ctor/p1.cpp index d2add82..5a45f7c 100644 --- a/test/CXX/special/class.conv/class.conv.ctor/p1.cpp +++ b/test/CXX/special/class.conv/class.conv.ctor/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -verify +// expected-no-diagnostics namespace PR13003 { struct void_type diff --git a/test/CXX/special/class.copy/p15-0x.cpp b/test/CXX/special/class.copy/p15-0x.cpp index fff8844..9d03a55 100644 --- a/test/CXX/special/class.copy/p15-0x.cpp +++ b/test/CXX/special/class.copy/p15-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s +// expected-no-diagnostics namespace PR10622 { struct foo { diff --git a/test/CXX/special/class.copy/p8-cxx11.cpp b/test/CXX/special/class.copy/p8-cxx11.cpp index a2613f4..4a9f3f2 100644 --- a/test/CXX/special/class.copy/p8-cxx11.cpp +++ b/test/CXX/special/class.copy/p8-cxx11.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -verify +// expected-no-diagnostics // C++98 [class.copy]p5 / C++11 [class.copy]p8. diff --git a/test/CXX/special/class.ctor/p1.cpp b/test/CXX/special/class.ctor/p1.cpp index 9500a7d..4d82184 100644 --- a/test/CXX/special/class.ctor/p1.cpp +++ b/test/CXX/special/class.ctor/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics struct X0 { struct type { }; diff --git a/test/CXX/special/class.dtor/p2.cpp b/test/CXX/special/class.dtor/p2.cpp index b05c992..4a10eb9 100644 --- a/test/CXX/special/class.dtor/p2.cpp +++ b/test/CXX/special/class.dtor/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // PR5548 struct A {~A();}; diff --git a/test/CXX/special/class.dtor/p3-0x.cpp b/test/CXX/special/class.dtor/p3-0x.cpp index 44bf5aa..291353a 100644 --- a/test/CXX/special/class.dtor/p3-0x.cpp +++ b/test/CXX/special/class.dtor/p3-0x.cpp @@ -45,7 +45,7 @@ G::~G() {} struct H { B b; - ~H(); + ~H() throw(int); }; H::~H() throw(int) {} diff --git a/test/CXX/special/class.dtor/p3.cpp b/test/CXX/special/class.dtor/p3.cpp new file mode 100644 index 0000000..6f4d5c7 --- /dev/null +++ b/test/CXX/special/class.dtor/p3.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -verify %s + +// The exception specification of a destructor declaration is matched *before* +// the exception specification adjustment occurs. +namespace DR1492 { + struct A { ~A(); }; // expected-note {{here}} + A::~A() noexcept {} // expected-warning {{previously declared with an implicit exception specification}} + + struct B { ~B() noexcept; }; // expected-note {{here}} + B::~B() {} // expected-warning {{previously declared with an explicit exception specification}} + + template<typename T> struct C { + T t; + ~C(); // expected-note {{here}} + }; + template<typename T> C<T>::~C() noexcept {} // expected-error {{does not match previous}} +} diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp index 96bb472..3952afd 100644 --- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp +++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp @@ -3,20 +3,24 @@ struct pr12960 { int begin; void foo(int x) { - for (int& it : x) { // expected-error {{use of undeclared identifier 'begin'}} expected-note {{range has type 'int'}} + for (int& it : x) { // expected-error {{invalid range expression of type 'int'; no viable 'begin' function available}} } } }; -namespace std { +struct null_t { + operator int*(); +}; + +namespace X { template<typename T> - auto begin(T &&t) -> decltype(t.begin()) { return t.begin(); } // expected-note 4{{ignored: substitution failure}} + auto begin(T &&t) -> decltype(t.begin()) { return t.begin(); } // expected-note 2{{ignored: substitution failure}} template<typename T> auto end(T &&t) -> decltype(t.end()) { return t.end(); } // expected-note {{candidate template ignored: substitution failure [with T = }} template<typename T> auto begin(T &&t) -> decltype(t.alt_begin()) { return t.alt_begin(); } // expected-note {{selected 'begin' template [with T = }} \ - expected-note 4{{candidate template ignored: substitution failure [with T = }} + expected-note 2{{candidate template ignored: substitution failure [with T = }} template<typename T> auto end(T &&t) -> decltype(t.alt_end()) { return t.alt_end(); } // expected-note {{candidate template ignored: substitution failure [with T = }} @@ -27,19 +31,28 @@ namespace std { } using namespace inner; -} -struct A { // expected-note 2 {{candidate constructor}} - A(); - int *begin(); // expected-note 3{{selected 'begin' function with iterator type 'int *'}} expected-note {{'begin' declared here}} - int *end(); -}; + struct A { // expected-note 2 {{candidate constructor}} + A(); + int *begin(); // expected-note 3{{selected 'begin' function with iterator type 'int *'}} expected-note {{'begin' declared here}} + int *end(); + }; -struct B { - B(); - int *alt_begin(); - int *alt_end(); -}; + struct B { + B(); + int *alt_begin(); + int *alt_end(); + }; + + struct NoBeginADL { + null_t alt_end(); + }; + struct NoEndADL { + null_t alt_begin(); + }; +} + +using X::A; void f(); void f(int); @@ -49,19 +62,19 @@ void g() { A __begin; for (char *a : A()) { // expected-error {{cannot initialize a variable of type 'char *' with an lvalue of type 'int'}} } - for (char *a : B()) { // expected-error {{cannot initialize a variable of type 'char *' with an lvalue of type 'int'}} + for (char *a : X::B()) { // expected-error {{cannot initialize a variable of type 'char *' with an lvalue of type 'int'}} } // FIXME: Terrible diagnostic here. auto deduction should fail, but does not! for (double a : f) { // expected-error {{cannot use type '<overloaded function type>' as a range}} } for (auto a : A()) { } - for (auto a : B()) { + for (auto a : X::B()) { } for (auto *a : A()) { // expected-error {{variable 'a' with type 'auto *' has incompatible initializer of type 'int'}} } // : is not a typo for :: here. - for (A NS:A()) { // expected-error {{no viable conversion from 'int' to 'A'}} + for (A NS:A()) { // expected-error {{no viable conversion from 'int' to 'X::A'}} } for (auto not_in_scope : not_in_scope) { // expected-error {{use of undeclared identifier 'not_in_scope'}} } @@ -92,9 +105,6 @@ void g() { for (auto a : VoidBegin()) // expected-error {{cannot use type 'void' as an iterator}} ; - struct null_t { - operator int*(); - }; struct Differ { int *begin(); // expected-note {{selected 'begin' function with iterator type 'int *'}} null_t end(); // expected-note {{selected 'end' function with iterator type 'null_t'}} @@ -110,15 +120,9 @@ void g() { for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}} for (constexpr int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'constexpr'}} - struct NoBeginADL { - null_t alt_end(); - }; - struct NoEndADL { - null_t alt_begin(); - }; - for (auto u : NoBeginADL()) { // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type 'NoBeginADL'}} + for (auto u : X::NoBeginADL()) { // expected-error {{invalid range expression of type 'X::NoBeginADL'; no viable 'begin' function available}} } - for (auto u : NoEndADL()) { // expected-error {{no matching function for call to 'end'}} expected-note {{range has type 'NoEndADL'}} + for (auto u : X::NoEndADL()) { // expected-error {{invalid range expression of type 'X::NoEndADL'; no viable 'end' function available}} } struct NoBegin { @@ -129,14 +133,15 @@ void g() { }; for (auto u : NoBegin()) { // expected-error {{range type 'NoBegin' has 'end' member but no 'begin' member}} } - for (auto u : NoEnd()) { // expected-error {{range type 'NoEnd' has 'begin' member but no 'end' member}} + for (auto u : NoEnd()) { // expected-error {{range type 'NoEnd' has 'begin' member but no 'end' member}} } struct NoIncr { void *begin(); // expected-note {{selected 'begin' function with iterator type 'void *'}} void *end(); }; - for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}} + for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}}\ + expected-note {{in implicit call to 'operator++' for iterator of type 'NoIncr'}} } struct NoNotEq { @@ -144,7 +149,19 @@ void g() { NoNotEq end(); void operator++(); }; - for (auto u : NoNotEq()) { // expected-error {{invalid operands to binary expression}} + for (auto u : NoNotEq()) { // expected-error {{invalid operands to binary expression}}\ + expected-note {{in implicit call to 'operator!=' for iterator of type 'NoNotEq'}} + } + + struct NoDeref { + NoDeref begin(); // expected-note {{selected 'begin' function}} + NoDeref end(); + void operator++(); + bool operator!=(NoDeref &); + }; + + for (auto u : NoDeref()) { // expected-error {{indirection requires pointer operand}} \ + expected-note {{in implicit call to 'operator*' for iterator of type 'NoDeref'}} } struct NoCopy { @@ -156,8 +173,7 @@ void g() { for (int n : NoCopy()) { // ok } - for (int n : 42) { // expected-error {{no matching function for call to 'begin'}} \ - expected-note {{range has type 'int'}} + for (int n : 42) { // expected-error {{invalid range expression of type 'int'; no viable 'begin' function available}} } for (auto a : *also_incomplete) { // expected-error {{cannot use incomplete type 'struct Incomplete' as a range}} @@ -166,7 +182,7 @@ void g() { template<typename T, typename U> void h(T t) { - for (U u : t) { // expected-error {{no viable conversion from 'A' to 'int'}} + for (U u : t) { // expected-error {{no viable conversion from 'X::A' to 'int'}} } for (auto u : t) { } @@ -179,14 +195,24 @@ template void h<A(&)[13], int>(A(&)[13]); // expected-note {{requested here}} template<typename T> void i(T t) { - for (auto u : t) { // expected-error {{no matching function for call to 'begin'}} \ + for (auto u : t) { // expected-error {{invalid range expression of type 'X::A *'; no viable 'begin' function available}} \ expected-error {{member function 'begin' not viable}} \ - expected-note {{range has type}} + expected-note {{when looking up 'begin' function}} + } } template void i<A[13]>(A*); // expected-note {{requested here}} template void i<const A>(const A); // expected-note {{requested here}} +struct StdBeginEnd {}; +namespace std { + int *begin(StdBeginEnd); + int *end(StdBeginEnd); +} +void DR1442() { + for (auto a : StdBeginEnd()) {} // expected-error {{invalid range expression of type 'StdBeginEnd'; no viable 'begin'}} +} + namespace NS { class ADL {}; int *begin(ADL); // expected-note {{no known conversion from 'NS::NoADL' to 'NS::ADL'}} @@ -204,9 +230,10 @@ void end(VoidBeginADL); void j() { for (auto u : NS::ADL()) { } - for (auto u : NS::NoADL()) { // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type}} + for (auto u : NS::NoADL()) { // expected-error {{invalid range expression of type 'NS::NoADL'; no viable 'begin' function available}} } for (auto a : VoidBeginADL()) { // expected-error {{cannot use type 'void' as an iterator}} + } } @@ -215,4 +242,3 @@ void example() { for (int &x : array) x *= 2; } - diff --git a/test/CXX/stmt.stmt/stmt.select/stmt.switch/p2-0x.cpp b/test/CXX/stmt.stmt/stmt.select/stmt.switch/p2-0x.cpp index 000c870..d0f15d4 100644 --- a/test/CXX/stmt.stmt/stmt.select/stmt.switch/p2-0x.cpp +++ b/test/CXX/stmt.stmt/stmt.select/stmt.switch/p2-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -verify +// expected-no-diagnostics struct Value { constexpr Value(int n) : n(n) {} diff --git a/test/CXX/temp/p3.cpp b/test/CXX/temp/p3.cpp index c146bc4..11f72de 100644 --- a/test/CXX/temp/p3.cpp +++ b/test/CXX/temp/p3.cpp @@ -8,7 +8,7 @@ template<typename T> int S<T>::a, S<T>::b; // expected-error {{can only declare template<typename T> struct A { static A a; } A<T>::a; // expected-error {{expected ';' after struct}} \ expected-error {{use of undeclared identifier 'T'}} \ - expected-warning{{extra qualification}} + expected-error{{extra qualification}} template<typename T> struct B { } f(); // expected-error {{expected ';' after struct}} \ expected-error {{requires a type specifier}} diff --git a/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp b/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp index b03ed46..67f317b 100644 --- a/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp +++ b/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s +// expected-no-diagnostics // C++03 imposed restrictions in this paragraph that were lifted with 0x, so we // just test that the example given now parses cleanly. diff --git a/test/CXX/temp/temp.decls/temp.alias/p1.cpp b/test/CXX/temp/temp.decls/temp.alias/p1.cpp index 966e3c1..aafe480 100644 --- a/test/CXX/temp/temp.decls/temp.alias/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.alias/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> using U = T; diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp index 2a3e914..df0e68d 100644 --- a/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp +++ b/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // PR8905 template<char C1, char C2> diff --git a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp index 97457ea..64cc592 100644 --- a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp +++ b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<int I, int J, class T> struct X { static const int value = 0; }; diff --git a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp index 87e21e4..184160a 100644 --- a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T, int N> struct A; diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp index 4c05c62..213f0c6 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> struct X1 { }; diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp index 70c9c70..fcbb724 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics extern "C" void * malloc(int); diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp index 63909fb..6d22f88 100644 --- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp +++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics // Core DR 532. namespace PR8130 { @@ -15,3 +16,30 @@ namespace PR8130 { int &ir = b * a; } } + +namespace OperatorWithRefQualifier { + struct A { }; + template<class T> struct B { + template<class R> int &operator*(R&) &&; + }; + + template<class T, class R> float &operator*(T&&, R&); + void test() { + A a; + B<A> b; + float &ir = b * a; + int &ir2 = B<A>() * a; + } +} + +namespace OrderWithStaticMember { + struct A { + template<class T> int g(T**, int=0) { return 0; } + template<class T> static int g(T*) { return 1; } + }; + void f() { + A a; + int **p; + a.g(p); + } +} diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp index 2ffdd95..8212a12 100644 --- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp +++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace DeduceVsMember { template<typename T> @@ -14,3 +15,15 @@ namespace DeduceVsMember { float& ir = (xi == xf); } } + +namespace OrderWithStaticMember { + struct A { + template<class T> int g(T**, int=0) { return 0; } + template<class T> static int g(T*) { return 1; } + }; + void f() { + A a; + int **p; + a.g(p); + } +} diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp index 4d34968..5f2dbb6 100644 --- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp +++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<class T> int &f(T); template<class T> float &f(T*, int=1); diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp index f42b94a..d24a3fb 100644 --- a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp +++ b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // All of these function templates are distinct. template<typename T> void f0(T) { } diff --git a/test/CXX/temp/temp.decls/temp.friend/p5.cpp b/test/CXX/temp/temp.decls/temp.friend/p5.cpp index 63fd3df..4b899e4 100644 --- a/test/CXX/temp/temp.decls/temp.friend/p5.cpp +++ b/test/CXX/temp/temp.decls/temp.friend/p5.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace test0 { template <class T> class A { diff --git a/test/CXX/temp/temp.decls/temp.mem/p1.cpp b/test/CXX/temp/temp.decls/temp.mem/p1.cpp index f5f1205..01eab24 100644 --- a/test/CXX/temp/temp.decls/temp.mem/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.mem/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template <class T> struct A { static T cond; diff --git a/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp index fec8060..2e24fc0 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics namespace DeductionForInstantiation { template<unsigned I, typename ...Types> diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp index db28eea..83e03bc 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Example bind implementation from the variadic templates proposal, // ISO C++ committee document number N2080. diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp index e15203a..4cbacf8 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Example function implementation from the variadic templates proposal, // ISO C++ committee document number N2080. diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp index 9de5fa8..f580047 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Example tuple implementation from the variadic templates proposal, // ISO C++ committee document number N2080. diff --git a/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp index b5786ac..c09c0b2 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Check for declaration matching with out-of-line declarations and // variadic templates, which involves proper computation of the diff --git a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp index 485068e..e0ffef5 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp @@ -187,6 +187,30 @@ namespace PacksAtDifferentLevels { add_pointer<float>, add_const<double>>>::value == 0? 1 : -1]; + namespace PR13811 { + constexpr int g(int n, int m) { return n * 10 + m; } + + template<typename...A> + struct X6 { + template<typename...B> + constexpr auto f1(A ...a) -> decltype(g(A(a + B())...)) { return g(A(a + B())...); } + + template<typename...B> + constexpr auto f2(A ...a, B ...b) -> decltype(g((&a)[b] ...)) { return g((&a)[b] ...); } // expected-note {{past-the-end}} + + template<typename...B> struct Inner { + template<typename...C> + constexpr auto f(A ...a, B ...b, C ...c) -> decltype(g(a+b+c...)) { return g(a+b+c...); } + }; + }; + struct A { constexpr operator int() { return 2; } }; + struct B { constexpr operator int() { return 1; } }; + + static_assert(X6<unsigned char, int>().f1<A, B>(255, 1) == 12, ""); + static_assert(X6<int, int>().f2(3, 4, 0, 0) == 34, ""); + static_assert(X6<int, int>().f2(3, 4, 0, 1) == 34, ""); // expected-error {{constant expression}} expected-note {{in call}} + static_assert(X6<int, int>::Inner<int, int>().f(1, 2, 3, 4, 5, 6) == 102, ""); + } } namespace ExpandingNonTypeTemplateParameters { diff --git a/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp index 71bd6aa..36535e3 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Various tests related to partial ordering of variadic templates. template<typename ...Types> struct tuple; diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp index 4d29b74..36b0700 100644 --- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics namespace ParameterPacksWithFunctions { template<typename ...> struct count; diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp index 81addfe..a9bda62 100644 --- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Metafunction to extract the Nth type from a set of types. template<unsigned N, typename ...Types> struct get_nth_type; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp index c14b063..47184ec 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics #if !__has_feature(cxx_access_control_sfinae) # error No support for access control as part of SFINAE? diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp index 6481485..1907bd7 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -verify %s +// expected-no-diagnostics typedef char one_byte; struct two_bytes { char data[2]; }; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp index c165c45..4be81d8 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> struct A { }; // bullet 1 diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp index 83b5f23..132d618 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace PR8598 { template<class T> struct identity { typedef T type; }; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp index 5a9ea08..badd5a8 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // FIXME: [temp.deduct.conv]p2 bullets 1 and 2 can't actually happen without // references? diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp index e23e98a..a5916ba 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics struct AnyPtr { template<typename T> operator T*() const; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp index b965300..ec7e897 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Note: Partial ordering of function templates containing template // parameter packs is independent of the number of deduced arguments diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp index f204caf..cc129c0 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> int &f0(T&); template<typename T> float &f0(T&&); diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp index 8183061..b38ade3 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename T> void f(T&&); template<> void f(int&) { } void (*fp)(int&) = &f; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp index 5b031c2..e3a9f57 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // If type deduction cannot be done for any P/A pair, or if for any // pair the deduction leads to more than one possible set of deduced diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp index 4e98a6d..20e6ea2 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Note: Template argument deduction involving parameter packs // (14.5.3) can deduce zero or more arguments for each parameter pack. diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp index fcc6cf7..09b1648 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // If the original function parameter associated with A is a function // parameter pack and the function parameter associated with P is not diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp index c819d97..d239a5e 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // FIXME: More bullets to go! diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp index a6b1172..6ef8e2f 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// expected-no-diagnostics // Deductions specific to C++0x. diff --git a/test/CXX/temp/temp.names/p2.cpp b/test/CXX/temp/temp.names/p2.cpp index 93e45dd..532dd84 100644 --- a/test/CXX/temp/temp.names/p2.cpp +++ b/test/CXX/temp/temp.names/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // Ensure that when enforcing access control an unqualified template name with // explicit template arguments, we don't lose the context of the name lookup diff --git a/test/CXX/temp/temp.names/p4.cpp b/test/CXX/temp/temp.names/p4.cpp index 103a1bd..64ca805 100644 --- a/test/CXX/temp/temp.names/p4.cpp +++ b/test/CXX/temp/temp.names/p4.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics struct meta { template<typename U> diff --git a/test/CXX/temp/temp.param/p10-0x.cpp b/test/CXX/temp/temp.param/p10-0x.cpp index 37bb284..21a96bf 100644 --- a/test/CXX/temp/temp.param/p10-0x.cpp +++ b/test/CXX/temp/temp.param/p10-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics template<typename> struct Y1; template<typename, int> struct Y2; diff --git a/test/CXX/temp/temp.param/p10.cpp b/test/CXX/temp/temp.param/p10.cpp index b9dac75..4feea82 100644 --- a/test/CXX/temp/temp.param/p10.cpp +++ b/test/CXX/temp/temp.param/p10.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<typename> struct Y1; template<typename, int> struct Y2; diff --git a/test/CXX/temp/temp.param/p13.cpp b/test/CXX/temp/temp.param/p13.cpp index 7e7dbe5..257b36f 100644 --- a/test/CXX/temp/temp.param/p13.cpp +++ b/test/CXX/temp/temp.param/p13.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // The scope of atemplate-parameterextends from its point of // declaration until the end of its template. In particular, a diff --git a/test/CXX/temp/temp.param/p15-cxx0x.cpp b/test/CXX/temp/temp.param/p15-cxx0x.cpp index 5fc57a4..59618d2 100644 --- a/test/CXX/temp/temp.param/p15-cxx0x.cpp +++ b/test/CXX/temp/temp.param/p15-cxx0x.cpp @@ -22,3 +22,157 @@ void f(const X<int> x) { template<typename T = void> struct X1 { }; X1<X1<>> x1a; + + +namespace ParameterPackExpansions { + +// A template parameter pack that [contains an unexpanded parameter pack] is a +// pack expansion. + +template<typename...Ts> struct Outer { + // From [temp.variadic]p4: + // In a template parameter pack that is a pack expansion, the pattern is + // [...the template-parameter...] without the ellipsis. + // Therefore the resulting sequence of parameters is not a parameter pack, + // so is not required to be the last template parameter. + template<Ts ...As, template<Ts> class ...Bs, typename ...Cs> struct Inner { + struct Check : Bs<As>... { + Check(Cs...); + }; + }; +}; + +template<int> struct TemplateInt {}; +template<char> struct TemplateChar {}; +template<int*> struct TemplateIntPtr {}; +int x; + +Outer<int, char, int*>:: +Inner<12345, 'x', &x, + TemplateInt, TemplateChar, TemplateIntPtr, + int*>:: +Check check(&x); + + +template<typename...Ts> struct types; + +enum place { _ }; +template<place...> struct places {}; + +template<typename P1, typename P2> struct append_places; +template<place...X1, place...X2> +struct append_places<places<X1...>, places<X2...>> { + typedef places<X1...,X2...> type; +}; + +template<unsigned N> +struct make_places : append_places<typename make_places<N/2>::type, + typename make_places<N-N/2>::type> {}; +template<> struct make_places<0> { typedef places<> type; }; +template<> struct make_places<1> { typedef places<_> type; }; + +template<typename T> struct wrap { + template<place> struct inner { typedef T type; }; +}; + +template<typename T> struct takedrop_impl; +template<place...X> struct takedrop_impl<places<X...>> { + template<template<decltype(X)> class ...Take, + template<place > class ...Drop> + struct inner { // expected-note 2{{declared}} + typedef types<typename Take<_>::type...> take; + typedef types<typename Drop<_>::type...> drop; + }; +}; + +template<unsigned N, typename...Ts> struct take { + using type = typename takedrop_impl<typename make_places<N>::type>:: + template inner<wrap<Ts>::template inner...>::take; // expected-error {{too few template arguments}} +}; +template<unsigned N, typename...Ts> struct drop { + using type = typename takedrop_impl<typename make_places<N>::type>:: + template inner<wrap<Ts>::template inner...>::drop; // expected-error {{too few template arguments}} +}; + +using T1 = take<3, int, char, double, long>::type; // expected-note {{previous}} +// FIXME: Desguar the types on the RHS in this diagnostic. +// desired-error {{'types<void, void, void, void>' vs 'types<int, char, double, (no argument)>'}} +using T1 = types<void, void, void, void>; // expected-error {{'types<void, void, void, void>' vs 'types<typename inner<_>::type, typename inner<_>::type, typename inner<_>::type, (no argument)>'}} +using D1 = drop<3, int, char, double, long>::type; +using D1 = types<long>; + +using T2 = take<4, int, char, double, long>::type; // expected-note {{previous}} +using T2 = types<int, char, double, long>; +// FIXME: Desguar the types on the RHS in this diagnostic. +// desired-error {{'types<void, void, void, void>' vs 'types<int, char, double, long>'}} +using T2 = types<void, void, void, void>; // expected-error {{'types<void, void, void, void>' vs 'types<typename inner<_>::type, typename inner<_>::type, typename inner<_>::type, typename inner<_>::type>'}} +using D2 = drop<4, int, char, double, long>::type; +using D2 = types<>; + +using T3 = take<5, int, char, double, long>::type; // expected-note {{in instantiation of}} +using D3 = drop<5, int, char, double, long>::type; // expected-note {{in instantiation of}} + + +// FIXME: We should accept this code. A parameter pack within a default argument +// in a template template parameter pack is expanded, because the pack is +// implicitly a pack expansion. +template<typename ...Default> struct DefArg { + template<template<typename T = Default> class ...Classes> struct Inner { // expected-error {{default argument contains unexpanded parameter pack}} expected-note {{here}} + Inner(Classes<>...); // expected-error {{too few}} + }; +}; +template<typename T> struct vector {}; +template<typename T> struct list {}; +vector<int> vi; +list<char> lc; +DefArg<int, char>::Inner<vector, list> defarg(vi, lc); + + +// FIXME: +// A template parameter pack that is a pack expansion shall not expand a +// parameter pack declared in the same template-parameter-list. +template<typename...Ts, Ts...Vs> void error(); // desired-error + +// This case should not produce an error, because in A's instantiation, Cs is +// not a parameter pack. +template<typename...Ts> void consume(Ts...); +template<typename...Ts> struct A { + template<template<typename, Ts = 0> class ...Cs, Cs<Ts> ...Vs> struct B { // ok + B() { + consume([]{ + int arr[Vs]; // expected-error {{negative size}} + }...); + } + }; +}; +template<typename, int> using Int = int; +template<typename, short> using Char = char; +A<int, short>::B<Int, Char, -1, 'x'> b; // expected-note {{here}} + +} + +namespace PR9023 { + template<typename ...T> struct A { + template<template<T> class ...> struct B { + }; + }; + + template<int> struct C { }; + template<long> struct D { }; + + int main() { + A<int, long>::B<C, D> e; + } +} + +namespace std_examples { + template <class... Types> class Tuple; + template <class T, int... Dims> struct multi_array; + template <class... T> struct value_holder { + template<T... Values> struct apply { }; + }; + template <class... T, T... Values> struct static_array; // expected-error {{must be the last}} + + int n; + value_holder<int, char, int*>::apply<12345, 'x', &n> test; +} diff --git a/test/CXX/temp/temp.param/p2.cpp b/test/CXX/temp/temp.param/p2.cpp index fed6e9c..4eca057 100644 --- a/test/CXX/temp/temp.param/p2.cpp +++ b/test/CXX/temp/temp.param/p2.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // There is no semantic difference between class and typename in a // template-parameter. typename followed by an unqualified-id names a diff --git a/test/CXX/temp/temp.param/p5.cpp b/test/CXX/temp/temp.param/p5.cpp index 3cbb3b7..67efc4e 100644 --- a/test/CXX/temp/temp.param/p5.cpp +++ b/test/CXX/temp/temp.param/p5.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -verify %s -std=c++11 +// expected-no-diagnostics template<const int I> struct S { decltype(I) n; diff --git a/test/CXX/temp/temp.param/p8.cpp b/test/CXX/temp/temp.param/p8.cpp index fed048c..592e41e 100644 --- a/test/CXX/temp/temp.param/p8.cpp +++ b/test/CXX/temp/temp.param/p8.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<int X[10]> struct A; template<int *X> struct A; template<int f(float, double)> struct B; diff --git a/test/CXX/temp/temp.res/temp.dep/p3.cpp b/test/CXX/temp/temp.res/temp.dep/p3.cpp index c41a4c6..88b4752 100644 --- a/test/CXX/temp/temp.res/temp.dep/p3.cpp +++ b/test/CXX/temp/temp.res/temp.dep/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics struct A0 { struct K { }; }; diff --git a/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp b/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp index 0aba402..8f2a599 100644 --- a/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp +++ b/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -verify %s +// expected-no-diagnostics template<int n> struct S; diff --git a/test/CXX/temp/temp.res/temp.local/p1.cpp b/test/CXX/temp/temp.res/temp.local/p1.cpp index 1ad4464..f6ef636 100644 --- a/test/CXX/temp/temp.res/temp.local/p1.cpp +++ b/test/CXX/temp/temp.res/temp.local/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // C++0x [temp.local]p1: // Like normal (non-template) classes, class templates have an diff --git a/test/CXX/temp/temp.res/temp.local/p7.cpp b/test/CXX/temp/temp.res/temp.local/p7.cpp index bd05e75..3fa9c99 100644 --- a/test/CXX/temp/temp.res/temp.local/p7.cpp +++ b/test/CXX/temp/temp.res/temp.local/p7.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<class T> struct A { int B; diff --git a/test/CXX/temp/temp.res/temp.local/p8.cpp b/test/CXX/temp/temp.res/temp.local/p8.cpp index 5d9d509..fecfed0 100644 --- a/test/CXX/temp/temp.res/temp.local/p8.cpp +++ b/test/CXX/temp/temp.res/temp.local/p8.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace N { enum { C }; diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp index 3843c0d..263356e 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics // This test creates cases where implicit instantiations of various entities // would cause a diagnostic, but provides expliict specializations for those diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp index 5fa2f62..f03811f 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<class T> class Array { /* ... */ }; template<class T> void sort(Array<T>& v); diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp index d4ce01f..10ec66d 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics namespace N { template<class T> class X { /* ... */ }; diff --git a/test/CXX/temp/temp.spec/temp.explicit/p11.cpp b/test/CXX/temp/temp.spec/temp.explicit/p11.cpp index 4ca5428..5363cbe 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p11.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p11.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics class X { template <typename T> class Y {}; diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp index 1028830..146b6b5 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -verify %s +// expected-no-diagnostics // If the name declared in the explicit instantiation is an // unqualified name, the explicit instantiation shall appear in the diff --git a/test/CXX/temp/temp.spec/temp.explicit/p6.cpp b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp index 1382272..0f5db21 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p6.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics template<class T> class Array { /* ... */ }; template<class T> void sort(Array<T>& v) { } |