#
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 *); / #1 void f(.); / #2 template<int N> void g() { f(0*N); / 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-formed struct 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]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant