Annex C (informative) Compatibility [diff]

C.3 C++ and ISO C++ 2011 [diff.cpp11]

This subclause lists the differences between C++ and ISO C++ 2011 (ISO/IEC 14882:2011, Programming Languages — C++), by the chapters of this document.

C.3.1 Clause [lex]: lexical conventions [diff.cpp11.lex]

[lex.ppnumber]
Change: pp-number can contain one or more single quotes.
Rationale: Necessary to enable single quotes as digit separators.
Effect on original feature: Valid C++ 2011 code may fail to compile or may change meaning in this International Standard. For example, the following code is valid both in C++ 2011 and in this International Standard, but the macro invocation produces different outcomes because the single quotes delimit a character literal in C++ 2011, whereas they are digit separators in this International Standard:

#define M(x, ...) __VA_ARGS__
int x[2] = { M(1'2,3'4) };
// int x[2] = {};      — C++ 2011
// int x[2] = { 3'4 }; — this International Standard

C.3.2 Clause [basic]: basic concepts [diff.cpp11.basic]

[basic.stc.dynamic.deallocation]
Change: New usual (non-placement) deallocator
Rationale: Required for sized deallocation.
Effect on original feature: Valid C++ 2011 code could declare a global placement allocation function and deallocation function as follows:

void operator new(std::size_t, std::size_t);
void operator delete(void*, std::size_t) noexcept;

In this International Standard, however, the declaration of operator delete might match a predefined usual (non-placement) operator delete ([basic.stc.dynamic]). If so, the program is ill-formed, as it was for class member allocation functions and deallocation functions ([expr.new]).

C.3.3 Clause [dcl.dcl]: declarations [diff.cpp11.dcl.dcl]

[dcl.constexpr]
Change: constexpr non-static member functions are not implicitly const member functions.
Rationale: Necessary to allow constexpr member functions to mutate the object.
Effect on original feature: Valid C++ 2011 code may fail to compile in this International Standard. For example, the following code is valid in C++ 2011 but invalid in this International Standard because it declares the same member function twice with different return types:

struct S {
  constexpr const int &f();
  int &f();
};

C.3.4 Clause [input.output]: input/output library [diff.cpp11.input.output]

[c.files]
Change: gets is not defined.
Rationale: Use of gets is considered dangerous.
Effect on original feature: Valid C++ 2011 code that uses the gets function may fail to compile in this International Standard.