dialect option change affect on existing code

Jonathan Wakely jwakely.gcc@gmail.com
Wed May 20 22:46:26 GMT 2020

On Wed, 20 May 2020 at 22:35, Ted Toth via Gcc <gcc@gcc.gnu.org> wrote:
> I work on a project with a large code base some of which is pretty old. We
> are discussing adding -std=gnu++11 to our g++ compiles to be able to use
> newer classes/features but there are concerns that there could be
> unintended consequences. For existing code that doesn't use any new
> features/classes  can it be expected that its function will not be altered
> by use of this flag? Will we have to regression all of our c++ code?

This question is not suitable for this mailing list, which is for
discussing development of GCC itself. Please use gcc-help instead, as
explained at https://gcc.gnu.org/lists.html (I've changed the mailing
list in the CC header already).

Subclause [diff.cpp03.lex] in the C++ standard lists differences
between C++11 and C++03. In most cases the changes will cause new
diagnostics for code that is valid in C++03, but will not change the
meaning. The change that is most likely to compile without diagnostics
but behave differently at runtime is that destructors are implicitly
noexcept in C++11, so a destructor that throws an exception will call
std::terminate() unless you modify the code to add noexcept(false) to
the destructor.

More information about the Gcc-help mailing list