[LLVMbugs] [Bug 12601] New: Unhelpful error message with member function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 20 02:22:12 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12601

             Bug #: 12601
           Summary: Unhelpful error message with member function
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris at bubblescope.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code (in this case the developer intended to make the operator<
static, or out-of-line).

struct A
{
    bool operator<(A,A) { return true; }
};

Produces the slightly bizarre error message:

t.cc:3:10: error: overloaded 'operator<' must be a binary operator (has 3
parameters)
    bool operator<(A,A) { return true; }
         ^
1 error generated.

After a little thought, I can see what is happening here (the '3rd parameter'
is the implicit this)

g++'s error message is slightly less confusing:

t.cc:3: error: ‘bool A::operator<(A, A)’ must take exactly one argument

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list