Is it possible to explicitly instantiate a template class through a template alias?
If so, how? Otherwise, can someone point to the ISO paper in which this was discussed and decided against?
template<class T>
struct A { };
/// Explicit instantiate A for int:
template struct A<int>;
/// Alias
template<class T>
using B = A<T>;
/// Explicitly instantiate A for double via alias B:
template struct B<double>;
/// error: elaborated type refers to a non-tag type
Shouldn't this instantiate A<double>
since B<T>
is just a different name for A<T>
?
typedef
because 14.7.2/3 requires an explicit instantiation of a class to use a simple-template-id. ButB<double>
is also grammatically a simple-template-id. – Madeline