Title 2264. Memberwise copying with indeterminate value
Status drafting Section 15.8 [class.copy]
Submitter Hubert Tong

Created on 2016-05-06.00:00:00 by admin, last changed by admin.

msg5898 (view) Date: 2018-04-11.00:00:00

It appears that the following example may have unwanted undefined behavior in C++, although not in C:

  struct A { int x, y; }; 
  A passthrough(A a) { return a; } 
  int main(void) { 
   A a; 
   a.x = 0; 
   return passthrough(a).x; 

The default memberwise copying operation is not specified to be done in a way that is insensitive to indeterminate values.

Date User Action Args
2018-04-11 00:00:00adminsetstatus: open -> drafting
2018-02-27 00:00:00adminsetsection: 12.8 [class.copy] -> 15.8 [class.copy]
2016-05-06 00:00:00admincreate