http://llvm.org/bugs/show_bug.cgi?id=11136
Summary: Bad diagnostic when passing address of overloaded
function to template
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
C++11 adds an overload to vector::push_back, leading to code that breaks with
the following error. The bad error happens in C++98 mode too.
$ cat test.cc
struct vector {
void push_back(const int&);
void push_back(int*);
};
template<typename T, typename R>
void NewCallback(T*, R (T::*)());
template<typename T, typename R, typename A1>
void NewCallback(T*, R (T::*)(A1));
void foo() {
vector v;
NewCallback(&v, &vector::push_back);
}
$ clang -c test.cc
test.cc:14:3: error: no matching function for call to 'NewCallback'
NewCallback(&v, &vector::push_back);
^~~~~~~~~~~
test.cc:7:6: note: candidate template ignored: couldn't infer template argument
'R'
void NewCallback(T*, R (T::*)());
^
test.cc:10:6: note: candidate template ignored: couldn't infer template
argument 'R'
void NewCallback(T*, R (T::*)(A1));
^
1 error generated.
----------
The error should refer to the function whose address doesn't have a unique
type, in addition to the template that failed to constrain the type.
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs