On Wed, Aug 15, 2018 at 7:44 AM Liu Hao <lh_mo...@126.com> wrote: > > 在 2018-08-15 12:48, Jeff Law 写道: > > I just don't think anyone's ever bothered to catch this case. I believe > > there is a BZ which touches on this issue. > > > > Yes, here it is: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78655 > > This PR uses a placement new as the example, which in GCC 8 assumes the > pointer argument to `operator new()` is never null. But for a general > case it is still not fixed. > > So it looks like nobody has been working on this. I will just fix my > code then.
Btw, I can't find wording in the standards that nullptr + 1 is invoking undefined behavior, that is, that pointer arithmetic is only allowed on pointers pointing to a valid object. Any specific pointers? Thanks, Richard. > > Jeff > > > > > -- > Best regards, > LH_Mouse >