Skip to content

Lookup of operator[] succeeds when should be ambiguous #27224

Closed as not planned
Closed as not planned
@llvmbot

Description

@llvmbot
Bugzilla Link 26850
Version unspecified
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @riccibruno

Extended Description

Consider the following reduced code example from a StackOverflow question:

struct X{};
struct Y{};

struct B
{
    void operator[](X){}
};

struct C
{
    void operator[](Y){}
};

struct D : B, C {};

int main()
{
    D d;
    d[Y()];
}

The call to D::operator[] should be ambiguous due to the two different base class overloads. A call to d.operator[](Y()) would correctly fail to compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++14clang:frontendLanguage frontend issues, e.g. anything involving "Sema"duplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions