This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
11.4.5.3 [class.copy.ctor] paragraph 15 refers only to "temporary class objects." It needs to be made clear that these provisions do not apply to temporaries that have been bound to references. For instance,
struct A { mutable int value; explicit A(int i) : value(i) {} void mutate(int i) const { value = i; } }; int foo() { A const& t = A(1); A n(t); // can this copy be elided? t.mutate(2); return n.value; // can this return 2? }The current wording seems to allow an implementation not to perform the copy in A N(t) because the source object is a temporary (created explicitly by A(1)).
Proposed resolution (10/00):
Change the wording proposed in the resolution of issue 20 from
- when a temporary class object (6.7.7 [class.temporary]) would be copied to a class object...
to
- when a temporary class object that has not been bound to a reference (6.7.7 [class.temporary]) would be copied to a class object...