This is the mail archive of the gcc-patches@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]

Re: c++ testsuite patches


Richard Henderson <rth@cygnus.com> said:
> There is one remaining problem,
> 
>    FAIL: g++.other/null1.C (test for excess errors)
> 
> which fails due to 
> 
>    extern void g(int);
>    extern void g(void *);
>    void foo() { g(__null); }
> 
>    z.cc:3: call of overloaded `g (NULL)' is ambiguous
>    z.cc:1: candidates are: void g(int)
>    z.cc:2:                 void g(void *)

AFAIU, C++ specifies that any 0-valued integer expression is NULL, so the
above complaint is correct: g(0) might be either g((int) 0) or g((void *)
0), and traditionally NULL is defined as plain 0 in C++. gcc is using
special magic here (__null), but it is advisable to keep the message, as
otherwise some programs that work under gcc will break elsewhere.

> If I add
> 
>    extern void g(long);
> 
> I get the same warning as on an x86 box
> 
>    z.cc:4: warning: converting NULL to non-pointer type
> 
> and the test passes.

This is broken, IMHO.
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile                               +56 32 672616


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