This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR 50565 (offsetof-type expressions in static initializers)
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Oct 2011 18:11:58 -0500
- Subject: Re: Fix PR 50565 (offsetof-type expressions in static initializers)
- References: <Pine.LNX.4.64.1110111531270.30672@digraph.polyomino.org.uk>
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.