https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to pj from comment #2)
> Initialising a `variant<double>` from an `int` should not be an error due to
> p0608.

That's not true, it is a narrowing conversion, and so should be rejected.


> Compared to before, p0608 only requires that `double x[] = {600};` is
> well formed. See https://wandbox.org/permlink/IHQ3NnuoNmQRr5a7

No, that's not equivalent. 600 is a constant and provably doesn't narrow.

If you use an arbitrary int value then the compiler tells you it involves a
narrowing conversion:

void FUN(double) {}

int main(int argc, char**)
{
    double x[] = {std::forward<int>(argc)};

    FUN({std::forward<int>(argc)});
}

So this is indeed due to the changes for P0608 and is the expected behaviour.

Reply via email to