Debian Codegraph @

gcc/testsuite/g++.dg/template/fn-ptr3a.C

raw
1 // PR c++/53164
2 // PR c++/105848
3 // A stricter version of fn-ptr3.C that verifies using f as a template
4 // argument alone constitutes an odr-use.
5
6 template<class T>
7 void f(T) { T::fail; } // { dg-error "fail" }
8
9 template<void (*P)(int)>
10 struct A {
11 // P not called
12 };
13
14 template<void (&P)(char)>
15 void wrap() {
16 // P not called
17 }
18
19 template<int>
20 void g() {
21 A<f> a; // { dg-message "required from" }
22 wrap<f>(); // { dg-message "required from" }
23 }
24
25 int main() {
26 g<0>();
27 }