1 // RUN: %clang_cc1 -fsyntax-only -verify %s
12 typedef Base CrazyBase
;
19 template<typename TheBase
, typename T
>
20 void call_f0_through_typedef(T x
) {
21 typedef TheBase Base2
;
25 void test_f0_through_typedef(X0 x0
) {
26 call_f0_through_typedef
<Base
>(x0
);
29 template<typename TheBase
, typename T
>
30 void call_f0_through_typedef2(T x
) {
31 typedef TheBase CrazyBase
; // expected-note{{current scope}}
32 x
.CrazyBase::f0(); // expected-error{{ambiguous}} \
33 // expected-error 2{{no member named}}
38 struct X1
: Base
, OtherBase
{
39 typedef OtherBase CrazyBase
; // expected-note{{object type}}
42 void test_f0_through_typedef2(X0 x0
, X1 x1
) {
43 call_f0_through_typedef2
<Base
>(x0
);
44 call_f0_through_typedef2
<OtherBase
>(x1
); // expected-note{{instantiation}}
45 call_f0_through_typedef2
<Base
>(x1
); // expected-note{{instantiation}}
53 template<typename T
, typename U
>
54 T
convert(const U
& value
) {
55 return value
.operator T(); // expected-error{{operator long}}
58 void test_convert(X2 x2
) {
60 convert
<long>(x2
); // expected-note{{instantiation}}
64 void destruct(T
* ptr
) {
70 void destruct_intptr(int *ip
) {
75 void test_destruct(X2
*x2p
, int *ip
) {
78 destruct_intptr
<int>(ip
);
84 template <int> float* &f0();
85 template <int> const float* &f0() const;
87 (void)static_cast<float*>(f0
<0>());
94 // Fun with template instantiation and conversions
97 float& member() const;
102 void f(T
* ptr
) { int& ir
= ptr
->member(); }
103 void g(T
* ptr
) { float& fr
= ptr
->member(); }
106 void test_X5(X5
<X4
> x5
, X5
<const X4
> x5c
, X4
*xp
, const X4
*cxp
) {
111 // In theory we can do overload resolution at template-definition time on this.
112 // We should at least not assert.
115 template <class T
> void foo() {}
118 template <class T
> struct Foo
: Base
{
140 template <class T
> class Base
;
141 template <class T
> class Derived
: public Base
<T
> {
144 // It's okay if at some point we figure out how to diagnose this
145 // at instantiation time.