Debian Codegraph @

clang/test/CXX/temp/temp.spec/temp.explicit/p7.cpp

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