diff options
Diffstat (limited to 'test/CXX/temp')
57 files changed, 272 insertions, 1 deletions
diff --git a/test/CXX/temp/p3.cpp b/test/CXX/temp/p3.cpp index c146bc4faade..11f72de918cb 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 b03ed46e92f0..67f317b01807 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 966e3c10e5de..aafe4808bb18 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 2a3e9142169c..df0e68d29b6f 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 97457ea213bb..64cc5923f008 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 87e21e4af845..184160ac78d1 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 4c05c622926d..213f0c60d5b3 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 70c9c70a41c0..fcbb724a7af0 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 63909fb7cdbd..6d22f8809365 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 2ffdd9579ecd..8212a125be60 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 4d34968d32aa..5f2dbb6018ce 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 f42b94a727d2..d24a3fb71d5d 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 63fd3df26900..4b899e4e5211 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 f5f12055c19e..01eab24757f0 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 fec8060955e3..2e24fc00dc1a 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 db28eea98a54..83e03bcc0ddb 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 e15203abc615..4cbacf830266 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 9de5fa84b48a..f5800471ac2d 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 b5786acf82a2..c09c0b243a92 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 485068e6486a..e0ffef5007a1 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 71bd6aa8eb52..36535e3f90ed 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 4d29b740d803..36b07002cf3d 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 81addfe4bdcd..a9bda621e98f 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 c14b063ab746..47184ec03455 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 6481485b2a08..1907bd77998f 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 c165c4530668..4be81d882588 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 83b5f2314011..132d61814227 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 5a9ea084fd61..badd5a8c6a2c 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 e23e98abe64d..a5916ba65377 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 b96530056b2c..ec7e8970b1b5 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 f204caf57abd..cc129c0a9b2e 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 8183061a8ab4..b38ade39edf2 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 5b031c24ed71..e3a9f5798dbf 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 4e98a6d15e1a..20e6ea2d7127 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 fcc6cf7ec732..09b1648e68e7 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 c819d973a941..d239a5e17200 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 a6b1172afccc..6ef8e2fd5ecd 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 93e45dd7e3b0..532dd84ecb43 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 103a1bd537f8..64ca80517b8c 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 37bb284a36eb..21a96bf613e6 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 b9dac75beb91..4feea828466e 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 7e7dbe58a7b5..257b36f4f96f 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 5fc57a43f541..59618d263683 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 fed6e9c266be..4eca05774ab5 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 3cbb3b7c0103..67efc4e48162 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 fed048cad8b6..592e41ec408e 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 c41a4c60ee74..88b4752e6b76 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 0aba4028b769..8f2a599ab28a 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 1ad4464c975c..f6ef636daa56 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 bd05e756a19e..3fa9c9952609 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 5d9d50913f36..fecfed06f109 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 3843c0d2c880..263356e949a3 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 5fa2f627b009..f03811f35e60 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 d4ce01fd6501..10ec66d53994 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 4ca54283157b..5363cbe0aedf 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 1028830abe75..146b6b5da80b 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 13822725b5bd..0f5db2119052 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) { } |
