This is the mail archive of the 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++/5310] Weird warnings about using (int)NULL

------- Comment #3 from gdr at gcc dot gnu dot org  2005-11-30 19:15 -------
(In reply to comment #2)
> On the mainline (20030526), I only get one warning:
> In function `void bar()':
> warning: passing NULL used for non-pointer argument 1 of `void 
>    foo(int)'
> Here is the proprocessed form of the testcase:
> void foo (int);
> void foo (long);
> void bar()
> {
>    foo ((int)__null);
>    foo ((long)__null);
> }

The issue here has several roots:
   (1) cp/call.c:convert_like_real() should warn only if !c_cast_p;
   (2) convert_like_real() was called (as convert_like_with_context)
       with c_cast_p set to false; which is one source of the bug
   (3) since __null is of type int, the cast to int was a no-op, and
       since the C++ front-end currently does not have a high level
       representation of the program (e.g. lowering is done as part of
       parsing), it does not have ways to make the difference.

Patches to correct any point above will be a progress.


gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
                 CC|                            |gdr at gcc dot gnu dot org

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