Skip to content

Inherited constructor is ignored during overload resolution #53975

Open
@Fedr

Description

@Fedr

In the following code

struct A {
    A() {}
    A(int) = delete;
};

struct B : A {
    using A::A;
    B(int&&) {}
};

int main() {
    B b(1);
}

GCC and MSVC print ambiguity error during constructor selection: neither B(int) nor B(int&&) is better than the other. But Clang prefers the constructor defined in B over the inherited one, which looks incorrect. Demo: https://gcc.godbolt.org/z/dnErEenE5

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++14clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions