Opened 10 years ago
#7658 new Bugs
Ambiguity error with function overloads
| Reported by: | Owned by: | Douglas Gregor | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | function |
| Version: | Boost 1.51.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
The following code (relevant for a convenient thread-callback API) fails to compile with VC2010 due to a C2668 error:
typedef boost::function<void (int i)> fooCallback;
typedef boost::function<void (int i, int k)> barCallback;
void TestBF(fooCallback fc) {}
void TestBF(barCallback bc) {}
void MyFunc (int a, int b) {}
int main(int argc, char **argv) {
TestBF (&MyFunc);
return 0;
}
Without calling TestBF in main, everything is fine, there is no multiple definition error. A (most likely) related discussion thread can be found here: http://boost.2283326.n4.nabble.com/Boost-Function-detecting-ignored-arguments-td4631919.html.
Note:
See TracTickets
for help on using tickets.
