Debian Codegraph @

gcc/testsuite/g++.dg/template/dependent-name16.C

raw
1 // { dg-do compile { target c++11 } }
2 template <int N> struct A { static void foo(){} };
3 template <> struct A<sizeof(char)> { using foo = int; };
4
5 template<class T1> auto f(T1 t1) -> decltype(A<sizeof(t1)>::foo());
6
7 /* if the comparing_specializations check breaks in cp_tree_equal
8 case PARM_DECL, the error will incorrectly report A<sizeof (t1)> */
9 template<class T2> auto g(T2 t2) -> decltype(A<sizeof(t2)>::foo()); // { dg-error "dependent-name .A<sizeof .t2.>::foo" }
10
11 void h() {
12 f(0);
13 g('0'); // { dg-error "no matching function" }
14 }