I have a class templated on a type parameter and parameter pack, and am confused about type-deduction of this type; while writing an output-streaming operator I discovered a par
Wow, I would have thought this was fixed already, but it still doesn't work in prerelease GCC 4.9 and Clang 3.4 builds (courtesy Coliru).
The workaround is simple: use partial specialization to deduce the template arguments elsewhere.
template
struct foo; // unimplemented
template
struct foo< T, Ts ... > // specialization for at least one argument
{ /* ... */ };
template< class... Ts >
std::ostream& operator<<( std::ostream& os, const foo& )
{
return os << 42;
}
Why both GCC and Clang can't solve this years-old bug by imitating the workaround in the general case, I don't know. The compiler vendors are perhaps facing an unfortunate choice between performance and correctness.