This is the mail archive of the gcc-patches@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]

Re: Fix PR 50565 (offsetof-type expressions in static initializers)


On Tue, Oct 11, 2011 at 10:32 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:

> The problem comes down to an expression with the difference of two
> pointers being cast to int on a 64-bit system, resulting in
> convert_to_integer moving the conversions inside the subtraction.
> (These optimizations at conversion time should really be done later as
> a part of folding, or even later than that, rather than
> unconditionally in convert_to_*, but that's another issue.)

Interesting. C++11 classified this as "linktime" constants, e.g. they
are constant
expressions for static initialization purposes, but not compile-time constant
expressions, precisely because of this kind of issues.


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