// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // This test concerns the identity of dependent types within the // canonical type system. This corresponds to C++ [temp.type], which // specifies type equivalence within a template. // // FIXME: template template parameters namespace N { template struct X2 { template struct apply { typedef U* type; }; }; } namespace Nalias = N; template struct X0 { }; using namespace N; template struct X1 { typedef T type; typedef U U_type; void f0(T); // expected-note{{previous}} void f0(U); void f0(type); // expected-error{{redeclar}} void f1(T*); // expected-note{{previous}} void f1(U*); void f1(type*); // expected-error{{redeclar}} void f2(X0*); // expected-note{{previous}} void f2(X0*); void f2(X0*); // expected-error{{redeclar}} void f3(X0*); // expected-note{{previous}} void f3(X0*); void f3(::X0*); // expected-error{{redeclar}} void f4(typename T::template apply*); // expected-note{{previous}} void f4(typename U::template apply*); void f4(typename type::template apply*); void f4(typename type::template apply*); // expected-error{{redeclar}} void f5(typename T::template apply::type*); // expected-note{{previous}} void f5(typename U::template apply::type*); void f5(typename U::template apply::type*); void f5(typename type::template apply::type*); void f5(typename type::template apply::type*); // expected-error{{redeclar}} void f6(typename N::X2::template apply *); // expected-note{{previous}} void f6(typename N::X2::template apply *); void f6(typename N::X2::template apply *); void f6(typename ::N::X2::template apply *); // expected-error{{redeclar}} void f7(typename N::X2::template apply *); // expected-note{{previous}} void f7(typename N::X2::template apply *); void f7(typename N::X2::template apply *); void f7(typename X2::template apply *); // expected-error{{redeclar}} void f8(typename N::X2::template apply *); // expected-note{{previous}} void f8(typename N::X2::template apply *); void f8(typename N::X2::template apply *); void f8(typename ::Nalias::X2::template apply *); // expected-error{{redeclar}} }; namespace PR6851 { template struct S; struct N { template S< S::cond && 1 > foo(); }; struct Arrow { Arrow *operator->(); int n; }; template struct M { Arrow a; auto f() -> Mn)>; }; struct Alien; bool operator&&(const Alien&, const Alien&); template S< S::cond && 1 > N::foo() { } template auto M::f() -> Mn)> {} } namespace PR7460 { template struct TemplateClass2 { enum { SIZE = 100 }; static T member[SIZE]; }; template T TemplateClass2::member[TemplateClass2::SIZE]; } namespace PR18275 { template struct A { void f(const int); void g(int); void h(const T); void i(T); }; template void A::f(int x) { x = 0; } template void A::g(const int x) { // expected-note {{declared const here}} x = 0; // expected-error {{cannot assign to variable 'x'}} } template void A::h(T) {} // FIXME: Should reject this. Type is different from prior decl if T is an array type. template void A::i(const T) {} // FIXME: Should reject this. Type is different from prior decl if T is an array type. template struct A; template struct A; } namespace PR21289 { template using X = int; template using Y = int; template struct S {}; template void f() { // This is a dependent type. It is *not* S, even though it canonically // contains no template parameters. using Type = S...>; Type s; using Type = S; } void g() { f(); } template void h(S) {} // Pending a core issue, it's not clear if these are redeclarations, but they // are probably intended to be... even though substitution can succeed for one // of them but fail for the other! template void h(S...>) {} // expected-note {{previous}} template void h(S...>) {} // expected-error {{redefinition}} }