What changes brought by C++14 could break a C++11 program?
C++14, the new C++ standard succeeding C++11, will bring a host of changes to the language. Although it is planned to be a small extension over its predecessor, featuring mainly bug fixes and small improvements, it is inevitable that a few changes might make a correct C++11 program break under a C++14-compliant compiler.
While the name C++14 suggests a release in 2014, this date is not fixed. Actually, the working draft of the language, N3936, was published on March 2, 2014 and if all national bodies approve it, the C++14 International Standard will be published in late summer.
Support for the new language features is also well underway on major C++ compilers: Clang "fully implements all of the current draft"; GCC and Visual Studio also offer some support for C++14 new features.
Most of C++14 new features will not break source compatibility with current C++11 standard. The introduction of generic lambdas, e.g., allowing lambda function parameters to be declared with the
auto type specifier, will not break compatibility with C++11 lambdas. However, it is foreseen that a number of new features will indeed be cause for some concerns. Thus, Stack Overflow user Filip Roséen collected all the relevant information that he could found in the working draft itself.
Here is a short list of changes that could potentially break C++11:
The digit separator was introduced so that one could, in a more readable manner, write numeric literals and split them up in a more natural way.
C++14 introduces the opportunity to declare a global overload of
operator deletesuitable for sized deallocation, something which wasn't possible in C++11.
constexprmember-functions, no longer implicitly
There are many changes to
constexprin C++14, but the only change that will change semantics between C++11, and C++14 is the constantness of a member-function marked as
std::getshas been removed from the Standard Library because it is considered dangerous.
For a more detailed discussion, including code samples, and references to C++ drafts, see the post on Stack Overflow.
Mike Keane Dec 21, 2014
Jeremy Stieglitz Dec 21, 2014