2811. "Selected constructor" wording is incorrect for optional/variant/any

Section: 23.6.3.1 [optional.ctor], 23.6.3.3 [optional.assign], 23.7.3.1 [variant.ctor], 23.8.3.1 [any.cons], 23.8.3.3 [any.modifiers] Status: New Submitter: Tim Song Opened: 2016-10-29 Last modified: 2017-02-02

Priority: 3

View all other issues in [optional.ctor].

View all issues with New status.

Discussion:

Throughout optional/variant/any's specification references are made to "the selected constructor of T". For example, 23.6.3.1 [optional.ctor]/16 says of the constructor from const T&:

-16- Remarks: If T's selected constructor is a constexpr constructor, this constructor shall be a constexpr constructor.

Similarly, the in-place constructor has this wording (23.6.3.1 [optional.ctor]/25-26):

-25- Throws: Any exception thrown by the selected constructor of T.

-26- Remarks: If T's constructor selected for the initialization is a constexpr constructor, this constructor shall be a constexpr constructor.

If T is a scalar type, it has no constructor at all. Moreover, even for class types, the in-place constructor wording ignores any implicit conversion done on the argument before the selected constructor is called, which 1) may not be valid in constant expressions and 2) may throw an exception; such exceptions aren't thrown "by the selected constructor of T" but outside it.

The wording should probably be recast to refer to the entire initialization.

[Issues Telecon 16-Dec-2016]

Priority 3; Jonathan to provide wording.

Proposed resolution: