C++ PATCH for core issue 903 (C++11 null pointer constant)

Jason Merrill jason@redhat.com
Tue Aug 23 16:22:00 GMT 2011


C++11 greatly expands the set of constant expressions, which aggravates 
the existing issue with overloading and null pointer constants.  If an 
expression could potentially be a constant expression, we need to find 
its constant value in order to determine how it interacts with overload 
resolution.  In C++03 that doesn't involve much beyond the constant 
folding we already do, but in C++11 that means substituting into 
constexpr functions, so we decided to limit null pointer constants in 
C++11 to literal 0 (or 0L, etc).

This patch doesn't attempt to treat things like 0+0 as non-null pointer 
constants yet, just avoids doing anything beyond the usual constant folding.

Tested x86_64-pc-linux-gnu, applying to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core-903.patch
Type: text/x-patch
Size: 1433 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110823/026e1bd9/attachment.bin>


More information about the Gcc-patches mailing list