https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784
--- Comment #9 from Ela <mct_ancs at yahoo dot com> --- (In reply to Ela from comment #8) > (In reply to Martin Liška from comment #7) > > > Same as the origin, it's obviously an invalid code. > > Tested on all Clang-3.8 C++11,14,17 - it works. > > gcc-6.1.0 is a bit more explicit in some sense: > - class instantiation w/ external leaves all > members non-inst. > - the missing function in the call (in main() ) > is written as some mangle, and not in_clear > (as it would be with other functions - that > one can add for test) > - thus seems as a lack of internal repres. or > something. > > Else please enlighten me on the correct syntax. ... actually I made it simpler, in order to get to the root of it: -------------------------------------------------- #include <iostream> using std::cout; template<typename T> class A{ public: template<typename U> void f(U const&) & ; template<typename U> void f(U const&) && ; }; template<typename T> template<typename U> void A<T>::f(U const& x) & { std::cout << "lvalue object\n" ; } template<typename T> template<typename U> void A<T>::f(U const& x) && { std::cout << "rvalue object\n" ; } template class A<int> ; template void A<int>::f<int>(int const&) & ; template void A<float>::f<int>(int const&) &&; int main(){ A<int> a ; a.f<int>(2); A<float>().f<int>(1); }