Movatterモバイル変換


[0]ホーム

URL:


Issue 2251 - WG21 CWG Issues
Title
Unreachable enumeration list-initialization
Status
c++17
Section
9.5.5 [dcl.init.list]
Submitter
Richard Smith

Created on2016-03-22.00:00:00 last changed96 months ago

Messages

msg5748 (view)
Date: 2016-12-15.00:00:00

Proposed resolution (December, 2016):

Reorder the bullets in 9.5.5 [dcl.init.list] paragraph 3 asfollows:

List-initialization of an object or reference of typeT isdefined as follows:

  • ...

  • Otherwise, ifT is a class type, constructors areconsidered...

  • Otherwise, ifT is an enumeration with a fixed underlyingtype (9.8.1 [dcl.enum]), theinitializer-list has a singleelementv, and the initialization is direct-list-initialization,the object is initialized with the valueT(v)(7.6.1.4 [expr.type.conv]); if a narrowing conversion is required toconvert v to the underlying type ofT, the program is ill-formed.[Example:...

  • Otherwise, if the initializer list has a single element oftypeE...

  • Otherwise, ifT is a reference type...

  • Otherwise, ifT is an enumeration with a fixedunderlying type...

msg5747 (view)
Date: 2017-02-15.00:00:00

[Adopted at the February/March, 2017 meeting.]

P0138R2 adds a new bullet for enum initialization after bullet 8 of9.5.5 [dcl.init.list] paragraph 3. However, paragraph 7 alreadydealt with all the cases where the initializer list contains a singleelement and the target type is a non-reference type, so the newparagraph 9 rule is unreachable.

History
DateUserActionArgs
2018-02-27 00:00:00adminsetstatus: review -> c++17
2017-02-06 00:00:00adminsetmessages: +msg5748
2016-03-22 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp