[LLVMbugs] [Bug 22734] New: clearer categories for overload resolution failures

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 27 14:49:09 PST 2015


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

            Bug ID: 22734
           Summary: clearer categories for overload resolution failures
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Testcase:

void overloaded(int, float);
void overloaded(float, int);
void overloaded(int, float, double);
void overloaded(float, int, double);
void test() {
  overloaded(1, 2, 3, 4);
  overloaded(1);
}

We emit a lengthy diagnostics pointing to each overload with a note. Consider
emitting "no matching function for call to 'overloaded', called with 4
arguments but no overload has that many parameters", and maybe not emitting all
the notes.

$ clang b14434192.cc
b14434192.cc:6:3: error: no matching function for call to 'overloaded'
  overloaded(1, 2, 3, 4);
  ^~~~~~~~~~
b14434192.cc:4:6: note: candidate function not viable: requires 3 arguments,
but
      4 were provided
void overloaded(float, int, double);
     ^
b14434192.cc:3:6: note: candidate function not viable: requires 3 arguments,
but
      4 were provided
void overloaded(int, float, double);
     ^
b14434192.cc:2:6: note: candidate function not viable: requires 2 arguments,
but
      4 were provided
void overloaded(float, int);
     ^
b14434192.cc:1:6: note: candidate function not viable: requires 2 arguments,
but
      4 were provided
void overloaded(int, float);
     ^
b14434192.cc:7:3: error: no matching function for call to 'overloaded'
  overloaded(1);
  ^~~~~~~~~~
b14434192.cc:2:6: note: candidate function not viable: requires 2 arguments,
but
      1 was provided
void overloaded(float, int);
     ^
b14434192.cc:1:6: note: candidate function not viable: requires 2 arguments,
but
      1 was provided
void overloaded(int, float);
     ^
b14434192.cc:4:6: note: candidate function not viable: requires 3 arguments,
but
      1 was provided
void overloaded(float, int, double);
     ^
b14434192.cc:3:6: note: candidate function not viable: requires 3 arguments,
but
      1 was provided
void overloaded(int, float, double);
     ^
2 errors generated.

-- 
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/20150227/8c332ba8/attachment.html>


More information about the llvm-bugs mailing list