Is it safe to link C++17, C++14, and C++11 objects asks about linking objects compiled with different language standards, and Jonathan Wakely's excellent answer on that question explains the ABI stability promises that gcc/libstdc++ make to enusure that this works.
There's one more thing that can change between gcc versions though - the language ABI via -fabi-version
. Let's say, for simplicity, I have three object files:
foo.o
, compiled with gcc 6.5 c++14bar.o
, compiled with gcc 7.4 c++14quux.o
, compiled with gcc 8.3 c++17
All with the respective default language ABIs (i.e. 10, 11, and 13). Linking these objects together is safe from the library perspective per the linked answer. But are there things that could go wrong from a language ABI perspective? Is there anything I should be watching out for? Most of the language ABI changes seem like they wouldn't cause issues, but the calling convention change for empty class types in 12 might?