[Bug c++/94890] std::tuple<aggregate>({0}) fails to compile with -std=c++2a

ville.voutilainen at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri May 1 14:28:45 GMT 2020


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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ville.voutilainen at gmail dot com
                 CC|                            |ville.voutilainen at gmail dot com
   Last reconfirmed|                            |2020-05-01
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #5 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
What happens with std::tuple<c> x({0}) is that the _UElements&&... constructor
is not a direct candidate, so we fall back to trying a copy constructor. That's
a match, and then it tries to convert the argument. Since c is constructible
from int, but not convertible from int, the match is the explicit constructor,
and calling that fails because initializing the argument is copy-init.

The fix that we can apply in tuple is to make __is_implicitly_constructible
look at either is_convertible or is_aggregate, and then negate properly
in __is_explicitly_constructible.

In other words, mine. :)


More information about the Gcc-bugs mailing list