This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

### 2903. The form of initialization for the emplace-constructors is not specified

Section: 20.7.3.2 [variant.ctor] Status: C++17 Submitter: United States Opened: 2017-02-03 Last modified: 2020-09-06

Priority: Not Prioritized

View other active issues in [variant.ctor].

View all other issues in [variant.ctor].

View all issues with C++17 status.

Discussion:

Addresses US 118

The form of initialization for the emplace-constructors is not specified. We are very clear to mandate "as if by direct non-list initialization" for each constructor in `optional`, so there is no ambiguity regarding parens vs. braces. That wording idiom should be followed by `variant`.

Proposed change: Insert the phrase "as if direct-non-list-initializing" at appropriate locations in paragraphs 19, 23, 27, and 31

[2017-02-20, Marshall adds wording]

[2017-02-27, Marshall adds wording to cover two more cases]

Previous resolution [SUPERSEDED]:

> This wording is relative to N4640.

> 1. Modify 20.7.3.2 [variant.ctor] paragraph 19 as indicated:

>    > Effects: Initializes the contained value as if direct-non-list-initializing an object of type `T` with the arguments `std::forward<Args>(args)...`.

> 2. Modify 20.7.3.2 [variant.ctor] paragraph 23 as indicated:

>    > Effects: Initializes the contained value as if direct-non-list-initializing constructing an object of type `T` with the arguments `il, std::forward<Args>(args)...`.

> 3. Modify 20.7.3.2 [variant.ctor] paragraph 27 as indicated:

>    > Effects: Initializes the contained value as if direct-non-list-initializing constructing an object of type `TI` with the arguments `std::forward<Args>(args)...`.

> 4. Modify 20.7.3.2 [variant.ctor] paragraph 31 as indicated:

>    > Effects: Initializes the contained value as if direct-non-list-initializing constructing an object of type `TI` with the arguments `il, std::forward(args)...`.

[Kona 2017-02-28]

Accepted as Immediate to resolve NB comment.

Proposed resolution:

This wording is relative to N4640.

1. Modify 20.7.3.2 [variant.ctor] paragraph 19 as indicated:

   > Effects: Initializes the contained value as if direct-non-list-initializing an object of type `T` with the arguments `std::forward<Args>(args)...`.

2. Modify 20.7.3.2 [variant.ctor] paragraph 23 as indicated:

   > Effects: Initializes the contained value as if direct-non-list-initializing constructing an object of type `T` with the arguments `il, std::forward<Args>(args)...`.

3. Modify 20.7.3.2 [variant.ctor] paragraph 27 as indicated:

   > Effects: Initializes the contained value as if direct-non-list-initializing constructing an object of type `TI` with the arguments `std::forward<Args>(args)...`.

4. Modify 20.7.3.2 [variant.ctor] paragraph 31 as indicated:

   > Effects: Initializes the contained value as if direct-non-list-initializing constructing an object of type `TI` with the arguments `il, std::forward(args)...`.

5. Modify 20.7.3.5 [variant.mod] paragraph 6 as indicated:

   > Effects: Destroys the currently contained value if `valueless_by_exception()` is false. Then direct-initializes the contained value as if direct-non-list-initializing constructing a value of type `TI` with the arguments `std::forward<Args>(args)...`.

6. Modify 20.7.3.5 [variant.mod] paragraph 11 as indicated:

   > Effects: Destroys the currently contained value if `valueless_by_exception()` is false. Then direct-initializes the contained value as if direct-non-list-initializing constructing a value of type `TI` with the arguments `il, std::forward<Args>(args)...`.