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

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Oct 12 00:45:00 GMT 2011


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.



More information about the Gcc-patches mailing list