blob: a9eb729ed5a1624348125671ca613b3a0f3d2c8c [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Anders Carlsson863dbcb2009-12-07 08:29:39 +00002
3namespace PR5557 {
4template <class T> struct A {
5 A();
Douglas Gregor159ef1e2010-01-06 04:44:19 +00006 virtual void anchor(); // expected-note{{instantiation}}
Anders Carlsson863dbcb2009-12-07 08:29:39 +00007 virtual int a(T x);
8};
9template<class T> A<T>::A() {}
Douglas Gregor159ef1e2010-01-06 04:44:19 +000010template<class T> void A<T>::anchor() { }
11
Anders Carlsson863dbcb2009-12-07 08:29:39 +000012template<class T> int A<T>::a(T x) {
13 return *x; // expected-error{{requires pointer operand}}
14}
15
Douglas Gregor159ef1e2010-01-06 04:44:19 +000016void f(A<int> x) {
17 x.anchor();
18}
Anders Carlsson863dbcb2009-12-07 08:29:39 +000019
20template<typename T>
21struct X {
22 virtual void f();
23};
24
25template<>
26void X<int>::f() { }
27}
Douglas Gregor159ef1e2010-01-06 04:44:19 +000028
29template<typename T>
30struct Base {
31 virtual ~Base() {
32 int *ptr = 0;
33 T t = ptr; // expected-error{{cannot initialize}}
34 }
35};
36
37template<typename T>
38struct Derived : Base<T> {
39 virtual void foo() { }
40};
41
42template struct Derived<int>; // expected-note{{instantiation}}
43