[diff.cpp11.dcl.dcl] (original) (raw)

Annex C (informative) Compatibility [diff]

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

C.5.5 [dcl]: declarations [diff.cpp11.dcl.dcl]

Affected subclause: [dcl.constexpr]

Change: constexpr non-static member functions are not implicitlyconst 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 revision of C++.

[Example 1: struct S { constexpr const int &f();int &f();};

This code is valid in C++ 2011 but invalid in this revision of C++ because it declares the same member function twice with different return types.

— _end example_]

Affected subclause: [dcl.init.aggr]

Change: Classes with default member initializers can be aggregates.

Rationale: Necessary to allow default member initializers to be used by aggregate initialization.

Effect on original feature: Valid C++ 2011 code may fail to compile or may change meaning in this revision of C++.

[Example 2: struct S { int m = 1;};struct X { operator int();operator S();}; X a{}; S b{a}; — _end example_]