Richard Smith

Core Issue 2434: Mandatory copy elision vs non-class objects

Change in [class.temporary] (6.7.7) paragraph 1:

Temporary objects are created: […]

Change in [class.temporary] (6.7.7) paragraph 3:

When an object of class type X is passed to or returned from a function, if A type X is trivially transferrable if When an object of trivially transferrable type is passed to or returned from a function, implementations are permitted to create a temporary object to hold the function parameter or result object. The temporary object is constructed from the function argument or return value, respectively, and the function's parameter or return object is initialized from the temporary object. For a parameter or return object of class type, the initialization is performed as if by using the eligible trivial constructor to copy the temporary (even if that constructor is inaccessible or would not be selected by overload resolution to perform a copy or move of the temporary object). [Note: This latitude is granted to allow objects of class type to be passed to or returned from functions in registers. — end note]
Drafting note: the Itanium C++ ABI uses the term "non-trivial for the purposes of calls" to denote the types that are required to be passed indirectly. The intent is that every type is exactly one of: