[Bug c++/24948] New: lookup chooses the wrong overload
sebor at roguewave dot com
gcc-bugzilla@gcc.gnu.org
Sun Nov 20 02:57:00 GMT 2005
I believe gcc is in error for calling the int* overload in the program below.
Sorry if this is a duplicate -- I went through the many lookup bugs in Bugzilla
but none of them looked quite like this one.
$ cat t.cpp && g++ -pedantic -W t.cpp && ./a.out
#include <assert.h>
int foo (void*) { return 0; }
template <class T> int bar (T *p) { return foo (p); }
int foo (int*) { return 1; }
int main ()
{
assert (0 == bar ((int*)0));
}
Assertion failed: 0 == bar ((int*)0), file t.cpp, line 9
Abort (core dumped)
--
Summary: lookup chooses the wrong overload
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sebor at roguewave dot com
GCC build triplet: all
GCC host triplet: all
GCC target triplet: all
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24948
More information about the Gcc-bugs
mailing list