[Bug libstdc++/92057] variant converting constructor fails for primitives

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 14 16:09:00 GMT 2019


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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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 can.

What happens inside the constructor after that is unrelated. That's how C++
works.


More information about the Gcc-bugs mailing list