c++: delayed parse DMI [PR96645]
commit346ab5a54a831ad9c78afcbd8dfe98e0e07e3070
authorJason Merrill <jason@redhat.com>
Tue, 22 Mar 2022 05:10:44 +0000 (22 01:10 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 24 Mar 2022 18:31:16 +0000 (24 14:31 -0400)
tree36735be4a7405f057480072aef7ba5231740aaef
parentf0530882d99abc410bb080051aa04e5cea848f18
c++: delayed parse DMI [PR96645]

With the changes for PR81359 and PR88368 to make get_nsdmi errors be treated
as substitution failure, we have the problem that if we check
std::is_default_constructible for a complete class that still has unparsed
default member initializers, we get an answer (false) that will be wrong
once the DMIs have been parsed.  The traits avoid this problem for regular
incomplete classes by giving an error if the operand is incomplete; we
should do the same if get_nsdmi is going to fail due to unparsed DMI.

PR c++/96645

gcc/cp/ChangeLog:

* cp-tree.h (type_has_default_ctor_to_be_synthesized): Declare.
* class.cc (type_has_default_ctor_to_be_synthesized): New.
(type_has_non_user_provided_default_constructor_1): Support it.
(type_has_non_user_provided_default_constructor): Now a wrapper.
* method.cc (complain_about_unparsed_dmi): New.
(constructible_expr): Call it.

gcc/testsuite/ChangeLog:

* g++.dg/ext/is_constructible3.C: Expect error.
* g++.dg/ext/is_constructible7.C: New test.
gcc/cp/class.cc
gcc/cp/cp-tree.h
gcc/cp/method.cc
gcc/testsuite/g++.dg/ext/is_constructible3.C
gcc/testsuite/g++.dg/ext/is_constructible7.C [new file with mode: 0644]