From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/CXX/temp/temp.decls/p3.cpp | 7 + clang/test/CXX/temp/temp.decls/temp.alias/p1.cpp | 8 + clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp | 45 +++ clang/test/CXX/temp/temp.decls/temp.alias/p3.cpp | 13 + .../CXX/temp/temp.decls/temp.class.spec/p6.cpp | 76 ++++ .../CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp | 8 + .../CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp | 13 + .../CXX/temp/temp.decls/temp.class.spec/p9.cpp | 26 ++ .../temp.class.spec/temp.class.order/p2.cpp | 48 +++ .../temp.class.spec.mfunc/p1-neg.cpp | 25 ++ .../temp.class.spec/temp.class.spec.mfunc/p1.cpp | 25 ++ .../temp.decls/temp.class/temp.mem.class/p1.cpp | 27 ++ .../temp.decls/temp.class/temp.mem.enum/p1.cpp | 152 ++++++++ .../temp.class/temp.mem.func/p1-retmem.cpp | 28 ++ .../temp.decls/temp.class/temp.mem.func/p1.cpp | 100 +++++ .../temp.decls/temp.class/temp.mem.func/p1inst.cpp | 17 + .../temp.decls/temp.class/temp.mem.func/pr5056.cpp | 17 + .../temp.decls/temp.class/temp.static/p1-inst.cpp | 28 ++ .../temp/temp.decls/temp.class/temp.static/p1.cpp | 26 ++ .../temp.decls/temp.fct/temp.func.order/p3-0x.cpp | 17 + .../temp.decls/temp.fct/temp.func.order/p3.cpp | 16 + .../temp.decls/temp.fct/temp.func.order/p4.cpp | 23 ++ .../temp.decls/temp.fct/temp.func.order/p5.cpp | 12 + .../temp.decls/temp.fct/temp.over.link/p4-neg.cpp | 27 ++ .../temp/temp.decls/temp.fct/temp.over.link/p4.cpp | 13 + .../temp/temp.decls/temp.fct/temp.over.link/p6.cpp | 16 + clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp | 358 ++++++++++++++++++ clang/test/CXX/temp/temp.decls/temp.friend/p3.cpp | 12 + clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp | 28 ++ clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp | 103 ++++++ clang/test/CXX/temp/temp.decls/temp.friend/p8.cpp | 6 + clang/test/CXX/temp/temp.decls/temp.mem/p1.cpp | 35 ++ clang/test/CXX/temp/temp.decls/temp.mem/p3.cpp | 6 + clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp | 79 ++++ .../temp/temp.decls/temp.variadic/deduction.cpp | 50 +++ .../temp/temp.decls/temp.variadic/example-bind.cpp | 352 ++++++++++++++++++ .../temp.decls/temp.variadic/example-function.cpp | 86 +++++ .../temp.decls/temp.variadic/example-tuple.cpp | 260 +++++++++++++ .../temp/temp.decls/temp.variadic/ext-blocks.cpp | 46 +++ .../temp.decls/temp.variadic/fixed-expansion.cpp | 127 +++++++ .../temp.variadic/injected-class-name.cpp | 75 ++++ .../temp.decls/temp.variadic/metafunctions.cpp | 274 ++++++++++++++ .../temp.variadic/multi-level-substitution.cpp | 251 +++++++++++++ .../test/CXX/temp/temp.decls/temp.variadic/p1.cpp | 9 + .../test/CXX/temp/temp.decls/temp.variadic/p2.cpp | 22 ++ .../test/CXX/temp/temp.decls/temp.variadic/p4.cpp | 193 ++++++++++ .../test/CXX/temp/temp.decls/temp.variadic/p5.cpp | 403 +++++++++++++++++++++ .../temp.variadic/parameter-matching.cpp | 43 +++ .../temp.decls/temp.variadic/partial-ordering.cpp | 61 ++++ 49 files changed, 3692 insertions(+) create mode 100644 clang/test/CXX/temp/temp.decls/p3.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.alias/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.alias/p3.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.mem.enum/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.friend/p3.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.friend/p8.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.mem/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.mem/p3.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/p1.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/p2.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/p4.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp create mode 100644 clang/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp (limited to 'clang/test/CXX/temp/temp.decls') diff --git a/clang/test/CXX/temp/temp.decls/p3.cpp b/clang/test/CXX/temp/temp.decls/p3.cpp new file mode 100644 index 0000000..41811ff --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/p3.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +template using A = int; +template using A = char; // expected-error {{partial specialization of alias templates is not permitted}} +template<> using A = char; // expected-error {{explicit specialization of alias templates is not permitted}} +template using A = char; // expected-error {{explicit instantiation of alias templates is not permitted}} +using A = char; // expected-error {{name defined in alias declaration must be an identifier}} diff --git a/clang/test/CXX/temp/temp.decls/temp.alias/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.alias/p1.cpp new file mode 100644 index 0000000..966e3c1 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.alias/p1.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +template using U = T; + +// The name of the alias template is a template-name. +U x; +void f(U); +typedef U>>> I; diff --git a/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp b/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp new file mode 100644 index 0000000..a5b39fe --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +template using U = T; + +using I = U>>>; +using I = int; + +template using Fst = A; +template using Snd = B; + +using I = Fst,double>; + +namespace StdExample { + // Prerequisites for example. + template struct vector { /* ... */ }; + + + template struct Alloc {}; + template using Vec = vector>; + Vec v; + + template + void process(Vec& v) // expected-note {{previous definition is here}} + { /* ... */ } + + template + void process(vector>& w) // expected-error {{redefinition of 'process'}} + { /* ... */ } + + template class TT> + void f(TT); // expected-note {{candidate template ignored}} + + template class TT> + void g(TT>); + + int h() { + f(v); // expected-error {{no matching function for call to 'f'}} + g(v); // OK: TT = vector + } + + + // v's type is same as vector>. + using VTest = vector>; + using VTest = decltype(v); +} diff --git a/clang/test/CXX/temp/temp.decls/temp.alias/p3.cpp b/clang/test/CXX/temp/temp.decls/temp.alias/p3.cpp new file mode 100644 index 0000000..afd9b4b --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.alias/p3.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +// The example given in the standard (this is rejected for other reasons anyway). +template struct A; +template using B = typename A::U; // expected-error {{no type named 'U' in 'A'}} +template struct A { + typedef B U; // expected-note {{in instantiation of template type alias 'B' requested here}} +}; +B b; + +template using U = int; +// FIXME: This is illegal, but probably only because CWG1044 missed this paragraph. +template using U = U; diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp new file mode 100644 index 0000000..d0fc797 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp @@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Test class template partial specializations of member templates. +template +struct X0 { + template struct Inner0 { + static const unsigned value = 0; + }; + + template struct Inner0 { + static const unsigned value = 1; + }; +}; + +template template +struct X0::Inner0 { + static const unsigned value = 2; +}; + +int array0[X0::Inner0::value == 0? 1 : -1]; +int array1[X0::Inner0::value == 1? 1 : -1]; +int array2[X0::Inner0::value == 2? 1 : -1]; + +// Make sure we can provide out-of-line class template partial specializations +// for member templates (and instantiate them). +template struct A { + struct C { + template struct B; + }; +}; + +// partial specialization of A::C::B +template template struct A::C::B { }; + +A::C::B absip; + +// Check for conflicts during template instantiation. +template +struct Outer { + template struct Inner; + template struct Inner {}; // expected-note{{previous}} + template struct Inner {}; // expected-error{{cannot be redeclared}} +}; + +Outer outer; // expected-note{{instantiation}} + +// Test specialization of class template partial specialization members. +template<> template +struct X0::Inner0 { + static const unsigned value = 3; +}; + +int array3[X0::Inner0::value == 0? 1 : -1]; +int array4[X0::Inner0::value == 3? 1 : -1]; +int array5[X0::Inner0::value == 2? 1 : -1]; + +namespace rdar8651930 { + template + struct Outer { + template + struct Inner; + + template + struct Inner { + static const bool value = true; + }; + + template + struct Inner { + static const bool value = false; + }; + }; + + int array0[Outer::Inner::value? 1 : -1]; + int array1[Outer::Inner::value? -1 : 1]; +} diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp new file mode 100644 index 0000000..aa1e2d4 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +template struct X1; + +template +struct X1<0, Values+1 ...>; // expected-error{{non-type template argument depends on a template parameter of the partial specialization}} + + diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp new file mode 100644 index 0000000..b754368 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +// -- The argument list of the specialization shall not be identical +// to the implicit argument list of the primary template. + +template +struct X1; + +template +struct X1 // expected-error{{class template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}} +{ }; + + diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp new file mode 100644 index 0000000..2a3e914 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR8905 +template +struct X { + static const bool value = 0; +}; + +template +struct X { + static const bool value = 1; +}; + +int check0[X<1, 2>::value == 0? 1 : -1]; +int check1[X<1, 1>::value == 1? 1 : -1]; + +template struct int_values { + static const unsigned value = 0; +}; + +template +struct int_values { + static const unsigned value = 1; +}; + +int check2[int_values<256, 12, 3>::value == 0? 1 : -1]; diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp new file mode 100644 index 0000000..97457ea --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp @@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template struct X { + static const int value = 0; +}; + +template struct X { + static const int value = 1; +}; + +template struct X { + static const int value = 2; +}; + +int array0[X<0, 0, float>::value == 0? 1 : -1]; +int array1[X<0, 1, int>::value == 1? 1 : -1]; +int array2[X<0, 0, int>::value == 2? 1 : -1]; + +namespace DependentSubstPartialOrdering { + template + struct X { + static const unsigned value = 1; + }; + + template + struct X { + static const unsigned value = 2; + }; + + template + struct X { + static const unsigned value = 3; + }; + + struct X1 { }; + + struct X2 { + typedef void is_b; + }; + + struct X3 { + typedef void is_a; + typedef void is_b; + }; + + int check_X1[X::value == 1? 1 : -1]; + int check_X2[X::value == 2? 1 : -1]; + int check_X3[X::value == 3? 1 : -1]; +} diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp new file mode 100644 index 0000000..59253db --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template +struct A; + +template // expected-note{{previous template declaration}} +struct A { + void f0(); + void f1(); + void f2(); +}; + +template<> +struct A { + void g0(); +}; + +// FIXME: We should probably give more precise diagnostics here, but the +// diagnostics we give aren't terrible. +// FIXME: why not point to the first parameter that's "too many"? +template // expected-error{{too many template parameters}} +void A::f0() { } + +template +void A::f1() { } // expected-error{{out-of-line definition}} diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp new file mode 100644 index 0000000..87e21e4 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template +struct A; + +template +struct A { + A(T); + ~A(); + + void f(T*); + + operator T*(); + + static T value; +}; + +template void A::f(X*) { } + +template X A::value; + +template A::A(X) { value = 0; } + +template A::~A() { } + +template A::operator X*() { return 0; } diff --git a/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp new file mode 100644 index 0000000..b65e1d0 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template +struct X0 { + struct Inner; +}; + +template +struct X0::Inner { + T x; + U y; + + void f() { x = y; } // expected-error{{incompatible}} +}; + + +void test(int i, float f) { + X0::Inner inner; + inner.x = 5; + inner.y = 3.4; + inner.f(); + + X0::Inner inner2; + inner2.x = &i; + inner2.y = &f; + inner2.f(); // expected-note{{instantiation}} +} diff --git a/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.enum/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.enum/p1.cpp new file mode 100644 index 0000000..f8cc009 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.enum/p1.cpp @@ -0,0 +1,152 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +template struct A { + enum E : T; // expected-note {{here}} + E v; + E f() { return A::e1; } // expected-error {{no member named 'e1' in 'A'}} + E g() { return E::e1; } + E h(); +}; + +A a; +A::E a0 = A().v; +int n = A::E::e1; // expected-error {{implicit instantiation of undefined member}} + +template enum A::E : T { e1, e2 }; + +// FIXME: Now that A::E is defined, we are supposed to inject its enumerators +// into the already-instantiated class A. This seems like a really bad idea, +// though, so we don't implement that, but what we do implement is inconsistent. +// +// Either do as the standard says, or only include enumerators lexically defined +// within the class in its scope. +A::E a1 = A::e1; // expected-error {{no member named 'e1' in 'A'}} + +A::E a2 = A::e2; + +template typename A::E A::h() { return e2; } +A::E a3 = A().h(); + + +template struct B { + enum class E; + E v; + E f() { return E::e1; } + E g(); +}; + +B b; +B::E b0 = B().v; + +template enum class B::E { e1, e2 }; +B::E b1 = B::E::e1; + +B::E b2 = B::E::e2; + +template typename B::E B::g() { return e2; } +B::E b3 = B().g(); + + +// Enumeration members of class templates can be explicitly specialized. For +// unscoped enumerations, specializations must be defined before the primary +// template is, since otherwise the primary template will be implicitly +// instantiated when we parse the nested name specifier. +template<> enum A::E : long long { e3, e4 }; // expected-error {{explicit specialization of 'E' after instantiation}} expected-note {{first required here}} + +template<> enum class B::E { e3, e4 }; +B::E b4 = B::E::e4; + +B::E b5; +template<> enum class B::E { e5 }; +void fb5() { b5 = decltype(b5)::e5; } +B::E b6 = B::E::e5; + + +template struct C { + enum class E : T; +}; + +template<> enum class C::E : long long { e3, e4 }; +C::E c0 = C::E::e3; + +C::E c1; +template<> enum class C::E : long { e5 }; +void fc1() { c1 = decltype(c1)::e5; } +C::E c2 = C::E::e5; + +template<> enum class C::E : int { e6 }; +template enum class C::E : T { e0 }; +C::E c3 = C::E::e6; +C::E c4 = C::E::e0; // expected-error {{no member named 'e0' in 'C::E'}} + + +// Enumeration members can't be partially-specialized. +template enum class B::E { e5, e6 }; // expected-error {{nested name specifier for a declaration cannot depend on a template parameter}} + + +// Explicit specializations can be forward-declared. +template +struct D { + enum class E { e1 }; +}; +template<> enum class D::E; +D::E d1 = D::E::e1; // expected-error {{incomplete type 'D::E'}} +template<> enum class D::E { e2 }; +D::E d2 = D::E::e2; +D::E d3 = D::E::e1; // expected-note {{first required here}} +D::E d4 = D::E::e2; // expected-error {{no member named 'e2'}} +template<> enum class D::E { e3 }; // expected-error {{explicit specialization of 'E' after instantiation}} + +template<> enum class D::E; +struct F { + // Per C++11 [class.friend]p3, these friend declarations have no effect. + // Only classes and functions can be friends. + template friend enum D::E; + template<> friend enum D::E; + + template<> friend enum D::E { e3 }; // expected-error {{cannot define a type in a friend declaration}} + +private: + static const int n = 1; // expected-note {{private here}} +}; +template<> enum class D::E { + e = F::n // expected-error {{private member}} +}; + +class Access { + friend class X; + + template + class Priv { + friend class X; + + enum class E : T; + }; + + class S { + typedef int N; // expected-note {{here}} + static const int k = 3; // expected-note {{here}} + + friend class Priv; + }; + + static const int k = 5; +}; + +template<> enum class Access::Priv::E + : Access::S::N { // expected-error {{private member}} + a = Access::k, // ok + b = Access::S::k // expected-error {{private member}} +}; + +template enum class Access::Priv::E : T { + c = Access::k, + d = Access::S::k +}; + +class X { + Access::Priv::E a = Access::Priv::E::a; + Access::Priv::E c = Access::Priv::E::d; + // FIXME: We should see an access error for this enumerator. + Access::Priv::E b = Access::Priv::E::d; +}; diff --git a/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp new file mode 100644 index 0000000..4c05c62 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template struct X1 { }; + +template +struct X0 { + typedef int size_type; + typedef T value_type; + + size_type f0() const; + value_type *f1(); + X1 f2(); +}; + +template +typename X0::size_type X0::f0() const { + return 0; +} + +template +typename X0::value_type *X0::f1() { + return 0; +}; + +template +X1::value_type*> X0::f2() { + return 0; +}; diff --git a/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp new file mode 100644 index 0000000..1764563 --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp @@ -0,0 +1,100 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template // expected-note{{previous template}} +class X0 { +public: + typedef int size_type; + + X0(int); + ~X0(); + + void f0(const T&, const U&); + + T& operator[](int i) const; + + void f1(size_type) const; + void f2(size_type) const; + void f3(size_type) const; + void f4() ; + + operator T*() const; + + T value; +}; + +template +void X0::f0(const T&, const U&) { // expected-note{{previous definition}} +} + +template +X& X0::operator[](int i) const { + (void)i; + return value; +} + +template +void X0::f1(int) const { } + +template +void X0::f2(size_type) const { } + +template // expected-error{{too many template parameters}} +void X0::f3(size_type) const { +} + +template +void X0::f4() { } // expected-error{{does not refer}} + +// FIXME: error message should probably say, "redefinition of 'X0::f0'" +// rather than just "redefinition of 'f0'" +template +void X0::f0(const T&, const U&) { // expected-error{{redefinition}} +} + +// Test out-of-line constructors, destructors +template +X0::X0(int x) : value(x) { } + +template +X0::~X0() { } + +// Test out-of-line conversion functions. +template +X0::operator T*() const { + return &value; +} + +namespace N { template class A {void a();}; } +namespace N { template void A::a() {} } + +// PR5566 +template +struct X1 { + template + struct B { void f(); }; +}; + +template +template +void X1::template B::f() { } + +// PR5527 +template