| 1 |
// Verify we check arity early before deduction without explicit |
| 2 |
// template arguments. |
| 3 |
// PR c++/84075 |
| 4 |
|
| 5 |
template<class T> |
| 6 |
struct trait { |
| 7 |
static const int value = T::value; // { dg-bogus "not a member of 'B'" } |
| 8 |
}; |
| 9 |
|
| 10 |
template<class T, int N = trait<T>::value> |
| 11 |
struct A { }; |
| 12 |
|
| 13 |
template<class T> |
| 14 |
void f(A<T, 42>, int); // #1 |
| 15 |
|
| 16 |
struct B { }; |
| 17 |
|
| 18 |
template<template<class> class TT> |
| 19 |
void f(TT<B>); // #2 |
| 20 |
|
| 21 |
int main() { |
| 22 |
A<int, 42> a; |
| 23 |
f(a, 0); // OK, deduction for #2 short-circuited and A<B> not specialized, |
| 24 |
// which would have resulted in a hard error |
| 25 |
} |