Debian Codegraph @

gcc/testsuite/g++.dg/template/dependent-name15.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 T> void f(T t1) {
6 A<sizeof(t1)>::foo();
7 }
8
9 template <class T> void g(T t2) {
10 /* if the comparing_specializations check breaks in cp_tree_equal
11 case PARM_DECL, the error will incorrectly report A<sizeof (t1)> */
12 A<sizeof(t2)>::foo(); // { dg-error "dependent-name .A<sizeof .t2.>::foo" }
13 }
14
15 void h() {
16 f(0);
17 g('0');
18 }