This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/24948] New: lookup chooses the wrong overload


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]