https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #14 from Jonathan Wakely ---
(In reply to pj from comment #9)
> The only modification described by the paper (relevant to this case) is the
> requirement that `T_i x[] = {std::forward(t)};` is well formed,
That code gives you a diagn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #13 from Jonathan Wakely ---
It does. The array initialization uses a braced-init-list, which is the context
in which narrowing conversions are diagnosed.
Please take this to stackoverflow if you're unclear what the change entails.
T
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #12 from pj at patrickjohnston dot org ---
Intentions aside, the concrete change given at the bottom of the paper doesn't
seem to reflect the non-narrowing conversion constraint
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #11 from Marshall Clow ---
With wrapping:
> Proposed Resolution:
> This paper proposes to constrain the variant converting constructor and the
> converting assignment operator to prevent narrowing conversions
> and conversions to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
Marshall Clow changed:
What|Removed |Added
CC||mclow.lists at gmail dot com
--- Comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #9 from pj at patrickjohnston dot org ---
I'm sorry to belabour this, but I don't see how narrowing conversions even has
anything to do with p0608.
The only modification described by the paper (relevant to this case) is the
requiremen
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #8 from Jonathan Wakely ---
Because the narrowing conversion happens inside the Double(int) constructor.
The constrain on the variant(T&&) constructor only checks if a Double can be
constructed from an int without narrowing. Which it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #7 from pj at patrickjohnston dot org ---
Yeah but the `variant{600}` doesn't fail to compile due to this
narrowing conversion
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #6 from Jonathan Wakely ---
Because the Double(int) constructor takes an int, and so passing it an int is
not a narrowing conversion.
Try defining that constructor differently and you'll get a warning about a
narrowing conversion ins
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #5 from pj at patrickjohnston dot org ---
So then why does `std::variant{600}` work just fine? (Where `Double` is
defined by `struct Double { double x; Double(int){} };`)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
Jonathan Wakely changed:
What|Removed |Added
Status|NEW |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
Jonathan Wakely changed:
What|Removed |Added
Keywords||rejects-valid
Status|WAITI
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
--- Comment #2 from pj at patrickjohnston dot org ---
Initialising a `variant` from an `int` should not be an error due to
p0608. Compared to before, p0608 only requires that `double x[] = {600};` is
well formed. See https://wandbox.org/permlink/I
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92057
Jonathan Wakely changed:
What|Removed |Added
Status|UNCONFIRMED |WAITING
Last reconfirmed|
14 matches
Mail list logo