1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
10 T field
; // expected-note{{in instantiation of member class}}
17 typedef typename X
<Inner
>::type
// expected-note{{in instantiation of template class}}
18 type
; // expected-note{{not-yet-instantiated member is declared here}}
21 typedef type field
; // expected-error{{no member 'type' in 'PR8965::Y<int>'; it has not yet been instantiated}}
25 Y
<int> y
; // expected-note{{in instantiation of template class}}
31 struct C
{ T
&foo(); };
34 struct E
{ T
&bar(); }; // expected-error{{cannot form a reference to 'void'}}
35 struct F
; // expected-note{{member is declared here}}
42 X
<int>::X
*xi
; // expected-error{{qualified reference to 'X' is a constructor name rather than a type}}
43 X
<float>::X
*xf
; // expected-error{{qualified reference to 'X' is a constructor name rather than a type}}
46 c1
= c2
; // expected-error{{incompatible pointer types assigning to 'X<int>::C *' from 'X<float>::C *'}}
47 xi
= xf
; // expected-error{{incompatible pointer types assigning to 'X<int>::X<int> *' from 'X<float>::X<float> *'}}
48 // FIXME: error above doesn't print the type X<int>::X cleanly!
51 void test_instantiation(X
<double>::C
*x
,
54 double &dr
= x
->foo();
56 f
->foo(); // expected-error{{implicit instantiation of undefined member 'X<float>::D::F'}}
61 X
<void>::C
*c3
; // okay
62 X
<void>::D::E
*e1
; // okay
63 X
<void>::D::E e2
; // expected-note{{in instantiation of member class 'X<void>::D::E' requested here}}
67 template <typename T
> struct Registry
{
71 node(int v
) { Head
= this; }
75 Registry
<int>::node
node(0);
79 // Redeclarations during explicit instantiations.
81 template <typename T
> class A
{
87 template class A
<int>;
89 template <typename T
> class B
{
97 template class B
<int>;
99 template <typename T
> class C
{
102 template <typename T
> class C
<T
>::Foo
{
105 template class C
<int>;
108 namespace AliasTagDef
{
112 #if __cplusplus <= 199711L
113 // expected-warning@-2 {{alias declarations are a C++11 extension}}
121 int m
= F
<int>::S().g();
122 int n
= F
<int>::U().g();
125 namespace rdar10397846
{
126 template<int I
> struct A
130 struct C
{ C() { int *ptr
= I
; } };
131 #if __cplusplus >= 201103L
132 // expected-error@-2 {{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
134 // expected-warning@-4 {{expression which evaluates to zero treated as a null pointer constant of type 'int *'}}
136 // expected-error@-6 {{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
140 template<int N
> void foo()
142 class A
<N
>::B::C X
; // expected-note 2 {{in instantiation of member function}}
143 int A
<N
+1>::B::C::*member
= 0;
148 foo
<0>(); // expected-note{{in instantiation of function template}}
149 foo
<1>(); // expected-note{{in instantiation of function template}}