We have a template member function of the form:
template <template <class> class TT>
TT<some_type> foo() const;
Now, in an invocation context where TT is explicitly specified from a dependent name:
template <class T_other>
void bar()
{
instance.foo<T_other::template_type>();
}
Visual Studio is able to compile the invocation. GCC complains:
error: dependent-name ‘SomeConcreteType::template_type’ is parsed as a non-type, but instantiation yields a type.
And advises to say typename SomeConcreteType::template_type
. Which does not work, since SomeConcreteType::template_type
is a template type, not a plain type.
EDIT: Now with a Godbolt minimal example https://godbolt.org/z/hvbb6jv9W
Use template
instead of typename
. And, note that while typename
would go before the ::
, template
goes after.
template<class T_other>
void bar() {
instance.foo<T_other::template template_type>();
}