RFC: Bug 92285 - Layout of istreambuf_iterator subobject depends on -std mode
Jonathan Wakely
jwakely@redhat.com
Wed Oct 30 12:51:00 GMT 2019
On 30/10/19 13:39 +0100, Marc Glisse wrote:
>On Wed, 30 Oct 2019, Jonathan Wakely wrote:
>>We have two options:
>>
>>1) Make the base class the same as it was in C++98, and override it
>>for other modes. The program above would always print 24. This makes
>>the layout always consistent with the GCC 4.6 layout, for all modes,
>>but incompatible with the default -std=gnu++14 mode since GCC 6 (and
>>incompatible with code explicitly using C++11 or C++14 in GCC 4.7 and
>>above).
>>
>>Or:
>>
>>2) Always use the new base class, and override it for C++98. The
>>program above would always print 16. This makes layout for C++98
>>compatible with the current -std=gnu++14 default, but no longer
>>compatible with C++98 code from previous releases.
>
>3) Don't use any base class, write the 5 typedefs manually.
>
>>N.B. the decision should not be "choose the option that makes
>>sizeof(J) smaller", because I can easily create an example where C++98
>>prints 16 and other modes print 24, so we're not trying to optimize
>>for size. What matters is compatibility, not the absolute value.
>
>3 is never bigger ;-)
Indeed, but it breaks compatibility with all previous versions and all
previous modes (and is non-conforming for C++98/11/14).
It's an option, but I don't like it.
More information about the Libstdc++
mailing list