p7.cpp revision 7d5ba55f58c070e5b9f8cee3a172e2da1fcd02af
1// RUN: clang-cc -fsyntax-only -verify %s
2
3template<typename T>
4struct X0 {
5  struct MemberClass {
6    T member; // expected-error{{with function type}}
7  };
8
9  T* f0(T* ptr) {
10    return ptr + 1; // expected-error{{pointer to function}}
11  }
12
13  static T* static_member;
14};
15
16template<typename T>
17T* X0<T>::static_member = ((T*)0) + 1; // expected-error{{pointer to function}}
18
19template class X0<int>; // okay
20
21template class X0<int(int)>; // expected-note 3{{requested here}}
22
23// Specialize everything, so that the explicit instantiation does not trigger
24// any diagnostics.
25template<>
26struct X0<int(long)>::MemberClass { };
27
28typedef int int_long_func(long);
29template<>
30int_long_func *X0<int_long_func>::f0(int_long_func *) { return 0; }
31
32template<>
33int_long_func *X0<int(long)>::static_member;
34
35template class X0<int(long)>;
36
37