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++/35669] NULL (__null) not considered different from 0 with C++



------- Comment #13 from redi at gcc dot gnu dot org  2009-12-08 10:48 -------
(In reply to comment #12)
> > The situation will be different with the upcoming C++1x standard where there
> > is null_ptr.
> 
> Yes, very different.  Per the accepted language defect and paper I cited here
> yesterday, in the upcoming standard, the compiler seems required to reject
> implicit conversion from NULL to int.  This PR then becomes a rejects-valid and
> an accepts-invalid bug, rather than an enhancement request for a warning.

I don't think that's true, implicit conversion from nullptr_t to int is
forbidden, but 0 is still a valid definition of NULL so conversion from NULL to
int is OK. And __null does not have type nullptr_t, changing it to have that
type would break a lot of code




> void test() {
>   if (__null); // Explicitly allowed in upcoming Standard (shouldn't warn, PR
> 24745)
>   int a = __null; // Disallowed(?) by upcoming Standard (should error, PR 35699
> (this PR))
>   int b = (int)__null; // Explicitly allowed in upcoming Standard (shouldn't
> warn, PR 5310)
> }
> 
> (In reply to comment #11)
> >  What would be the point of __null otherwise...?
> 
> Good question.
> 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35669


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