3.5 KiB
[diff.cpp03.expr]
Annex C (informative) Compatibility [diff]
C.6 C++ and ISO C++ 2003 [diff.cpp03]
C.6.3 [expr]: expressions [diff.cpp03.expr]
Affected subclause: [conv.ptr]
Change: Only literals are integer null pointer constants.
Rationale: Removing surprising interactions with templates and constant expressions.
Effect on original feature: Valid C++ 2003 code may fail to compile or produce different results in this revision of C++.
[Example 1: void f(void ); // #1void f(...); // #2template void g() { f(0N); // calls #2; used to call #1} â end example]
Affected subclause: [expr.typeid]
Change: Evaluation of operands in typeid.
Rationale: Introduce additional expression value categories.
Effect on original feature: Valid C++ 2003 code that uses xvalues as operands for typeid may change behavior in this revision of C++.
[Example 2: void f() {struct B { B() {}virtual ~B() { }}; struct C { B b; }; typeid(C().b); // unevaluated in C++ 2003, evaluated in C++ 2011} â end example]
Affected subclause: [expr.mul]
Change: Specify rounding for results of integer / and %.
Rationale: Increase portability, C99 compatibility.
Effect on original feature: Valid C++ 2003 code that uses integer division rounds the result toward 0 or toward negative infinity, whereas this revision of C++ always rounds the result toward 0.
Affected subclause: [expr.log.and]
Change: && is valid in a type-name.
Rationale: Required for new features.
Effect on original feature: Valid C++ 2003 code may fail to compile or produce different results in this revision of C++.
[Example 3: bool b1 = new int && false; // previously false, now ill-formedstruct S { operator int(); };bool b2 = &S::operator int && false; // previously false, now ill-formed â end example]
Affected subclause: [expr.cond]
Change: Fewer copies in the conditional operator.
Rationale: Introduce additional expression value categories.
Effect on original feature: Valid C++ 2003 code that uses xvalues as operands for the conditional operator may change behavior in this revision of C++.
[Example 4: void f() {struct B { B() {} B(const B&) { }}; struct D : B {}; struct BB { B b; }; struct DD { D d; }; true ? BB().b : DD().d; // additional copy in C++ 2003, no copy or move in C++ 2011} â end example]