Reputation: 569
Why does the following CTAD attempt fail to compile ?
template <typename T> struct C { C(T,T) {} };
template <> struct C<int> { C(int) {} };
C c(1); //error: template argument deduction failure
I would have expected that the constructor C(int) would have been deduced.
Upvotes: 5
Views: 567
Reputation: 76628
Implicit deduction guides are only generated for constructors in the primary template, not for constructors of specializations.
You need to add the deduction guide explicitly:
C(int) -> C<int>;
Upvotes: 7