Title
C-style cast in braced-init-list assignment
Status
cd3
Section
7.6.19 [expr.ass]
Submitter
Daniel Krügler

Created on 2012-08-14.00:00:00 last changed 131 months ago

Messages

Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

Date: 2012-10-15.00:00:00

Proposed resolution (October, 2012):

Change 7.6.19 [expr.ass] paragraph 9 as follows:

The meaning of x={v}, where T is the scalar type of the expression x, is that of x=T(v) except that no narrowing conversion (9.4.5 [dcl.init.list]) is allowed x=T{v}. The meaning of x={} is x=T() x=T{}.
Date: 2012-11-03.00:00:00

According to 7.6.19 [expr.ass] paragraph 9,

The meaning of x={v}, where T is the scalar type of the expression x, is that of x=T(v) except that no narrowing conversion (9.4.5 [dcl.init.list]) is allowed. The meaning of x={} is x=T().

This definition adds a gratuitous C-style cast to the right-hand operand, inadvertently allowing such things as base-to-derived conversions and circumvention of access checking.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4392
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetmessages: + msg4055
2012-11-03 00:00:00adminsetstatus: open -> ready
2012-08-14 00:00:00admincreate