Bug 104204 - Ambiguity error for out of class definition of member function template in the presence of a member function of the same name
Summary: Ambiguity error for out of class definition of member function template in th...
Status: RESOLVED DUPLICATE of bug 64063
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2022-01-24 14:42 UTC by Fedor Chelnokov
Modified: 2022-01-24 19:14 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fedor Chelnokov 2022-01-24 14:42:57 UTC
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
Comment 1 Andrew Pinski 2022-01-24 18:19:45 UTC
Dup of bug 39270.

*** This bug has been marked as a duplicate of bug 39270 ***
Comment 2 Fedor Chelnokov 2022-01-24 18:54:02 UTC
Are you sure that this is a duplicate? Bug 39270 is about explicit instantiation that is erroneously reported by GCC as specialization. And this bug is about rejection of real explicit specialization in special circumstances.
Comment 3 Andrew Pinski 2022-01-24 19:14:08 UTC
Dup of bug 64063 really. sorry about that.

*** This bug has been marked as a duplicate of bug 64063 ***