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 // FIXME: expected-error{{unqualified-id}}
60 return NoDepBase::a
; // expected-error{{no member named 'a' in 'NoDepBase<T>'}}
68 typedef int type
; // expected-note{{member found by ambiguous name lookup}}
72 typedef float type
; // expected-note{{member found by ambiguous name lookup}}
76 struct Derived
: Base1
<T
>, Base2
{
77 typedef typename
Derived::type type
; // expected-error{{member 'type' found in multiple base classes of different types}}
78 type
*foo(float *fp
) { return fp
; }
81 Derived
<int> di
; // expected-note{{instantiation of}}
95 this->template f1
<int>()(k
);
106 this->template f1
<int>()(k
); // expected-error{{no member named 'f1' in 'C<T>'}} \
107 // FIXME: expected-error{{unqualified-id}} \
108 // expected-error{{function-style cast or type construction}} \
109 // expected-error{{expected expression}}
115 template <typename T
> class Base_A
{ };
119 template <typename T
>
121 : public virtual Base_A
<T
>
122 , public virtual Base_B
127 template <class T
> struct Base
{
131 template <class T
> struct Derived
: public Base
<T
> {
132 typename
Derived::Base
* p
; // meaning Derived::Base<T>