1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 template<typename T
, typename U
>
4 struct X0
: T::template apply
<U
> {
5 X0(U u
) : T::template apply
<U
>(u
) { }
8 template<typename T
, typename U
>
9 struct X1
: T::apply
<U
> { }; // expected-error{{use 'template' keyword to treat 'apply' as a dependent template name}}
12 struct X2
: vector
<T
> { }; // expected-error{{no template named 'vector'}}
23 typedef typename A
<TT
>::type type
;
29 C
<typename
FI::type
> a
;
35 C
<typename
FI2::type
> a
; // expected-error{{no type named 'type' in 'FI2<TT>'}}
41 template<typename U
> struct MemberTemplate
{ };
46 struct HasDepBase
: Base
<T
> {
48 class HasDepBase::Nested nested
;
49 typedef typename
HasDepBase::template MemberTemplate
<T
>::type type
;
57 class NoDepBase::Nested nested
; // expected-error{{no class named 'Nested' in 'NoDepBase<T>'}}
58 typedef typename
NoDepBase::template MemberTemplate
<T
>::type type
; // expected-error{{no member named 'MemberTemplate' in 'NoDepBase<T>'}}
59 return NoDepBase::a
; // expected-error{{no member named 'a' in 'NoDepBase<T>'}}
67 typedef int type
; // expected-note{{member type 'int' found by ambiguous name lookup}}
71 typedef float type
; // expected-note{{member type 'float' found by ambiguous name lookup}}
75 struct Derived
: Base1
<T
>, Base2
{
76 typedef typename
Derived::type type
; // expected-error{{member 'type' found in multiple base classes of different types}}
77 type
*foo(float *fp
) { return fp
; }
80 Derived
<int> di
; // expected-note{{instantiation of}}
94 this->template f1
<int>()(k
);
105 this->template f1
<int>()(k
); // expected-error{{no member named 'f1' in 'C<T>'}}
111 template <typename T
> class Base_A
{ };
115 template <typename T
>
117 : public virtual Base_A
<T
>
118 , public virtual Base_B
123 template <class T
> struct Base
{
127 template <class T
> struct Derived
: public Base
<T
> {
128 typename
Derived::Base
* p
; // meaning Derived::Base<T>
135 template <typename T
> struct A
{
140 template <typename T
> struct A
<T
>::B
: A
<T
> {