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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to