I'm trying to reuse existing templated functions from a namespace in my own namespace and explicitly instantiate them for code coverage reasons.
The following code compiles with gcc 9.3 but does not compile with clang 10.0.0
namespace bar {
template<typename T>
T func(T arg){ return arg;};
}
namespace foo {
using bar::func;
}
template int foo::func<int>(int);
int main()
{ }
View example here
If i instantiate the template function as
template int bar::func<int>(int);
clang compiles as well. But this is not what i want.
Is it possible to explicitly instantiate a template function across namespaces with clang?
Why do gcc and clang give different results?