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

            Bug ID: 36226
           Summary: Inheriting operator() from multiple classes doesn't
                    cause ambiguity on overload resolution
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: ix...@yandex.ru
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The following code snippet (to my knowledge) should be rejected because the
overload resolution can't cope with the ambiguity of which operator() to call.
This ambiguity is described in [class.member.lookup] section of the C++
standard.

#include <iostream>

using namespace std;

struct IntPrinter
{
    void operator()(int i)
    {
    }
};

class FloatPrinter
{
public:
    void operator()(float f)
    {
    }
};

struct Printer: IntPrinter, FloatPrinter
{
};

int main()
{
    Printer printer;
    printer(55);
    printer(55.1f);
};

The code compiles fine but should fail to compile. It doesn't compile on gcc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to