Bug 110330 - GCC does not diagnose ambiguous function introduced from base class
Summary: GCC does not diagnose ambiguous function introduced from base class
Status: RESOLVED DUPLICATE of bug 82894
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 13.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 82894
Blocks:
  Show dependency treegraph
 
Reported: 2023-06-20 22:28 UTC by Csaba Ráduly
Modified: 2023-06-20 22:42 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 Csaba Ráduly 2023-06-20 22:28:26 UTC
The following code

struct Foo{};
struct Bar{};

struct Base {
    Foo func1(const Foo , const Bar = Bar{}) const {
        return {};
    };
};

struct Derived : public Base {
    using Base::func1;
    Foo func1(const Foo ) const {
        return {};
    };
};

int main() {
    Foo foo;
    Derived der;
    der.func1(foo);
}

is rejected by ICX and clang, but accepted by GCC (up to 13.1). https://godbolt.org/z/4M3rrs3r4

The consensus at https://stackoverflow.com/questions/76517300/gcc-does-not-see-function-introduced-from-base-class-as-ambiguous seems to be that this is a bug.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84832 was shown as a possible duplicate, although the problem there wasn't ambiguity.
Comment 1 Andrew Pinski 2023-06-20 22:36:49 UTC
I think this is a dup of bug 82894. Specifically see bug 82894 comment #2 .
Comment 2 Andrew Pinski 2023-06-20 22:42:44 UTC
(In reply to Andrew Pinski from comment #1)
> I think this is a dup of bug 82894. Specifically see bug 82894 comment #2 .

Yes it is a dup. GCC 6 rejected the code as ambiguous even.

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