This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/80737] variant<any> as class member resulting to compile errors


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

--- Comment #5 from TC <rs2740 at gmail dot com> ---
(In reply to Tim Shen from comment #3)
> (In reply to TC from comment #1)
> > Looks like the constraint on the convert-everything constructor needs to
> > check for is_same<decay_t<_Tp>, variant> first and short circuit if that's
> > true.
> 
> I'm not quite sure whether we need that short circuit - it's in a SFINAE
> environment, so if anything goes wrong, there shouldn't be a hard error.
> Therefore even if I agree that we should check is_same<decay_t<_Tp>,
> variant> first, that shouldn't affect the correctness.

I'm not sure I agree. As http://stackoverflow.com/a/43963065/2756719 points
out, when you attempt to copy a variant<any>, as part of overload resolution
the code attempts to check if you can convert a variant<any> to any; that in
turn queries whether variant<any> is copy constructible, and we are very close
to turtling all the way down.

It does seem like there might be a frontend problem here, though.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]