https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104204

            Bug ID: 104204
           Summary: Ambiguity error for out of class definition of member
                    function template in the presence of a member function
                    of the same name
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This code is accepted by other compilers:
```
template<typename T>
struct A {
    void f();
    template<typename U>
    void f();
};

template<>
template<typename U>
void A<double>::f() { }
```
but GCC complains:
```
error: ambiguous template specialization 'f<>' for 'void A<double>::f()'
```
Demo: https://gcc.godbolt.org/z/sfP5Kzr7Y

Related discussion: https://stackoverflow.com/q/56362063/7325599

Reply via email to