[Bug c++/96645] [9/10/11/12 Regression] [CWG2335] std::variant default constructor and unparsed DMI

eyalroz1 at gmx dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 22 20:56:01 GMT 2022


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

--- Comment #18 from Eyal Rozenberg <eyalroz1 at gmx dot com> ---
(In reply to Jason Merrill from comment #14)
> > Alternatively, when not following the standard strictly, why should it not
> > be option (4.): Ignore the official restriction on determining (nothrow)
> > constructibility, make a best-effort attempt to determine it anyway ( which
> > in this example should succeed), and report failure otherwise.
> > 
> > ?
> 
> If we can define such a best-effort attempt, it could be a candidate for
> standardization.

Try to resolve is_nothrow_constructible<A> as long as this resolution does not
involve DataWithMember or any of its constituents (e.g. as though we had seen
the initializer expression before the definition of DataWithVariant even
began). If that  succeeds - we're good; if it fails - that's an error all on
its own and we (sort of) don't care about the DataWithVariant error; and if it
trips the wire and tries to refer to DataWithMember or a constituent thereof -
give up on the parse attempt.

Now, this is not _best_ effort, it's actually _minimal_ effort, since we're not
willing to even accept use of A and its constituents, but it's still something.
Not a candidate for standardization though.


More information about the Gcc-bugs mailing list