[Bug libstdc++/99058] Consider adding a note about std::optional ABI break to the C++17 status table

bspencer at blackberry dot com gcc-bugzilla@gcc.gnu.org
Wed Feb 10 19:44:50 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99058

--- Comment #3 from Brad Spencer <bspencer at blackberry dot com> ---
(In reply to Jonathan Wakely from comment #1)
> C++17 support isn't stable until GCC 9 so there is no guarantee of
> compatibility between 7 and 8 or 8 and 9. That applies to the entire library
> (and language features) not just std::optional.

Ok.  What's the right way for me to learn what version of GCC has stable
support for a C++ version?  For example, where would I look to know that C++17
support isn't stable until GCC 9?  I can't seem to find that information on the
status page, but maybe I am looking in the wrong place.

(In reply to Jonathan Wakely from comment #2)
> (In reply to Brad Spencer from comment #0)
> > Perhaps I was misusing this table, but I interpreted "supported since 7.1"
> > to mean that if I compile against 7.1 headers, my code will remain ABI
> > compatible against future versions of the library _and_ other code compiled
> > against future versions of the headers.
> 
> Absolutely not.

Sorry.  I was imprecise in my wording.  I am not looking for or expecting any
guarantees.

I am under the (possibly mistaken) impression that the libstdc++ ABI (in a
given configuration) has been stable for a very long time, and that generally
integrators (such as Debian or Ubuntu, for example) provide versions of
libstdc++ that are ABI-compatible with code compiled against previous versions. 
As per https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html this is
reflected in the long-standing .so major version of 6.  I know there are many
caveats here, especially around the early introduction of pre-standardized
features, etc.

Is it correct to think that the _intention_ is that it is possible to configure
the library to remain ABI compatible into the future until a conscious decision
is made to introduce an ABI break?

Or, if I ever run code compiled with GCC N against the library from GCC N+1, am
I always at risk, with not even best efforts to lean on?

I'm not asking you to do more.  I just want to get a good understanding of the
circumstances of ABI stability.


More information about the Gcc-bugs mailing list