Doc. no.: | P0608R0 |
---|---|

Date: | 2017-03-02 |

Audience: | LEWG, LWG |

Reply-to: | Zhihao Yuan <zy at miator dot net> |

See LEWG 227.

This wording is relative to N4640.

Modify 20.7.3.1 [variant.ctor]/12 as indicated:

`template <class T> constexpr variant(T&& t) noexcept(see below );`

In the following sections, let

be an exposition only trait defined as:`is_non_narrowing_convertible_v`

```
template <typename From, typename To>
constexpr bool
```*is_non_narrowing_convertible_v* = *see below*;

isis_non_narrowing_convertible_v<From, To>`true`

ifis_convertible_v<From, To>is`true`

and converting a non-constant object of`From`

to`To`

does not require a narrowing conversion (8.6.4) or a boolean conversion (4.14), otherwise`false`

.

Let

`T`

be a type that is determined as follows: build an imaginary function_{j}`FUN`

`(T`

_{i}`)`

for each alternative type`T`

, where_{i}`FUN`

`(T`

_{i}`)`

shall not participate in overload resolution unlessis_non_narrowing_convertible_v<T, T_{i}>is`true`

. The overload`FUN`

`(T`

_{i}`)`

selected by overload resolution for the expression`FUN`

(std::forward<T>(t))defines the alternative`T`

which is the type of the contained value after construction._{j}

[…]

Modify 20.7.3.3 [variant.assign]/8 as indicated:

`template <class T> variant& operator=(T&& t) noexcept(see below );`

Let

`T`

be a type that is determined as follows: build an imaginary function_{j}`FUN`

`(T`

_{i}`)`

for each alternative type`T`

, where_{i}`FUN`

`(T`

_{i}`)`

shall not participate in overload resolution unlessis_non_narrowing_convertible_v<T, T_{i}>is`true`

. The overload`FUN`

`(T`

_{i}`)`

selected by overload resolution for the expression`FUN`

(std::forward<T>(t))defines the alternative`T`

which is the type of the contained value after assignment._{j}

[…]