This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: c++ testsuite patches
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: c++ testsuite patches
- From: Horst von Brand <vonbrand at sleipnir dot valparaiso dot cl>
- Date: Sun, 09 May 1999 08:50:05 -0400
- cc: egcs-patches at egcs dot cygnus dot com
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