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]

Re: C++ PATCH to cp/decl.c: Timing name lookup

On Thu, 13 Feb 2003, Jason Merrill wrote:

> It's not spurious.  (0,0) is not a valid null pointer constant; an integral
> constant-expression may not contain a comma operator.

And we ought to get rid of GCC's C extensions that allow such things 
without -pedantic.  Extensions to integer constant expressions aren't 
documented; the C standard allows additional types of constant expression 
to be permitted in initializers, but not additional types to be accepted 
as integer constant expressions; and allowing things that aren't as 
constant expressions can *add* warnings as well as removing them.

(We do need one extension to integer constant expressions so that offsetof 
yields one.  For now we simply allow expressions like those in offsetof as 
constant; to get things correct, those sorts of expressions need to be a 
new type, "symbolic difference constant expressions" (see previous 
discussion <> - 
though it isn't clear from that discussion that they do need to be 
recognised as constant expressions in initializers at all, just folded for 
optimization), and there needs to be a __constant_expression__ extension 
that causes its contents to be treated as an integer constant expression 
(or arithmetic constant expression, etc.) if we can manage to fold it to 
such a constant even though it doesn't meet the language requirements for 
a constant expression.)

Joseph S. Myers

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