1 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 template <class T
> struct A
{
9 template<class T
> A
<T
>::A() {}
10 template<class T
> void A
<T
>::anchor() { }
12 template<class T
> int A
<T
>::a(T x
) {
13 return *x
; // expected-error{{requires pointer operand}}
17 x
.anchor(); // expected-note{{instantiation}}
33 T t
= ptr
; // expected-error{{cannot initialize}}
38 struct Derived
: Base
<T
> {
39 virtual void foo() { }
42 template struct Derived
<int>; // expected-note {{in instantiation of member function 'Base<int>::~Base' requested here}}
45 struct HasOutOfLineKey
{
47 virtual T
*f(float *fp
);
51 T
*HasOutOfLineKey
<T
>::f(float *fp
) {
52 return fp
; // expected-error{{cannot initialize return object of type 'int *' with an lvalue of type 'float *'}}
55 HasOutOfLineKey
<int> out_of_line
; // expected-note{{in instantiation of member function 'HasOutOfLineKey<int>::f' requested here}}
62 class A
{ virtual ~A(); }; // expected-note{{declared private here}}
67 class Inner
: public A
{ }; // expected-error{{base class 'PR7114::A' has private destructor}}
69 static const unsigned value
= sizeof(i
) == 4;
72 int f() { return B
<int>::value
; }
74 void test_typeid(B
<float>::Inner bfi
) {
75 (void)typeid(bfi
); // expected-note{{implicit default destructor}}
83 void test_X(X
<int> xi
, X
<float> xf
) {