Debian Codegraph @

gcc/testsuite/g++.dg/template/conv20.C

raw
1 // Verify we check arity early before deduction without explicit
2 // template arguments.
3
4 template<class T>
5 struct A;
6
7 template<class T>
8 struct B : A<T> { };
9
10 template<class T> void f(A<T>&, int); // #1
11 template<class T> void f(B<T>&); // #2
12
13 int main() {
14 extern B<int> b;
15 ::f(b); // OK, deduction for #1 short-circuited and B<int> not instantiated,
16 // which would have resulted in a hard error
17 }