I\'d like to ask whether the following code sample should compile:
#include
#include
#include
using namespa
A (seemingly related) quote from the standard 14.1 Template parameters
14 . A template-parameter of a template template-parameter is permitted to have a default template-argument. When such default arguments are specified, they apply to the template template-parameter in the scope of the template template-parameter.
[ Example:
template struct B {};
template class T> struct A {
inline void f();
inline void g();
};
template class T> void A::f() { // (*)
T<> t; // error - TT has no default template argument
}
template class T> void A::g() {
T<> t; // OK - T
}
— end example ]
This is the only verse posing limitations to the use of default template parameters of template template parameters (verse 9,11,12 pose limitations on the definition/specification)
As stressed in the comments, OP's case does not involve a default parameter in convert_container (so the above does not apply explicitly). IMHO there are two ways of interpreting the situation :
using type = C is a type alias for a class template; that class "loses" the right to use default template parameters, since it's passed as a template template parameter and all default arguments (of that TT parameter) lie outside the scope of the "typedefing". Then VS is correct.
By tracking the instantiation process : Say a correct compiler instantiates the struct as so (it's just a type substitution - no actual representation of the actual instantiation process is implied)
struct convert_container
{
using type = vector;
};
then OP's case seems fairly legit (and gcc/clang are correct)
This compiles in VS2013
template class C>
using tt = C;
int main()
{
std::cout << typeid(tt).name();
}
So the arguments of default template parameters being non legal to pass to template template parameters seems more and more shaky.