Debian Codegraph @

gcc/testsuite/g++.dg/diagnostic/pr100716.C

raw
1 // { dg-options "-fpretty-templates" }
2
3 template<typename T>
4 struct A
5 {
6 template<typename U>
7 void f() {} // { dg-line Af }
8
9 template<typename U>
10 void g(U) {} // { dg-line Ag }
11 };
12
13 template<typename T>
14 struct B
15 {
16 template<typename U>
17 void f(U) {} // { dg-line Bf }
18
19 template<typename U>
20 void g(U, T) {} // { dg-line Bg }
21 };
22
23 struct C
24 {
25 template<typename U>
26 void f(U) {} // { dg-line Cf }
27
28 template<typename U>
29 void g() {} // { dg-line Cg }
30 };
31
32 int main()
33 {
34 A<int>().f(0); // { dg-error "no matching function for call to 'A<int>::f\\(int\\)'" }
35 // { dg-message "candidate 1: 'template<class U> void A<T>::f\\(\\) \\\[with T = int\\\]'" "" { target *-*-* } Af }
36
37 A<int>().g(); // { dg-error "no matching function for call to 'A<int>::g\\(\\)'" }
38 // { dg-message "candidate 1: 'template<class U> void A<T>::g\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Ag }
39
40 B<int>().f(); // { dg-error "no matching function for call to 'B<int>::f\\(\\)'" }
41 // { dg-message "candidate 1: 'template<class U> void B<T>::f\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Bf }
42
43 B<int>().g(); // { dg-error "no matching function for call to 'B<int>::g\\(\\)'" }
44 // { dg-message "candidate 1: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = int\\\]'" "" { target *-*-* } Bg }
45
46 B<float>().g(0); // { dg-error "no matching function for call to 'B<float>::g\\(int\\)'" }
47 // { dg-message "candidate 1: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = float\\\]'" "" { target *-*-* } Bg }
48
49 C().f(); // { dg-error "no matching function for call to 'C::f\\(\\)'" }
50 // { dg-message "candidate 1: 'template<class U> void C::f\\(U\\)'" "" { target *-*-* } Cf }
51
52 C().g(0); // { dg-error "no matching function for call to 'C::g\\(int\\)'" }
53 // { dg-message "candidate 1: 'template<class U> void C::g\\(\\)'" "" { target *-*-* } Cg }
54 }