Local type as template argument is forbidden in C++03:
template<typename T>
struct Foo { };
void Make()
{
struct Unknown {};
Foo<Unknown> foo; // Bad
}
Is there any directives in Standard about checking this rule in case of template is not instantiated?
Is it possible to be sure, that this rule is checked only after template instantiation attempt (no instantiation => compilation success)?
template<typename T>
struct Foo { };
template<typename T>
void Do(T&) { }
template<typename T>
void Do(T*) // usage with pointer is forbidden by-design
{
struct Unknown {};
Foo<Unknown>::UnknownMethod();
}
int main()
{
std::string s;
Do(s);
}