https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86195
Bug ID: 86195 Summary: Ref-qualified nested class member function issue Product: gcc Version: 8.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: paolo.monteverde at gmail dot com Target Milestone: --- #include <utility> template<typename T> struct A final { struct B final { template<typename P, typename... Args> void foo(Args &&... args) && { A::foo<P>(std::forward<Args>(args)...); } }; private: template<typename P, typename... Args> static auto foo(Args &&...) {} }; int main() { A<int>::B{}.foo<int>(); } This code doesn't compile under GCC 8.1.1; it works on GCC 7.3. If you rename the private static foo() member function (and its invocation) to a name different than foo, the code will compile on GCC 8.1.1 too.