[llvm-bugs] [Bug 26850] New: Lookup of operator[] succeeds when should be ambiguous

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 5 07:50:47 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26850

            Bug ID: 26850
           Summary: Lookup of operator[] succeeds when should be ambiguous
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: barry.revzin at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider the following reduced code example from a StackOverflow question
(http://stackoverflow.com/q/35373384/2069064):

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160305/080eeeda/attachment-0001.html>


More information about the llvm-bugs mailing list