]> gcc.gnu.org Git - gcc.git/commit
c++: limit instantiation with ill-formed class [PR96286]
authorJason Merrill <jason@redhat.com>
Sun, 29 Aug 2021 22:17:22 +0000 (18:17 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 30 Aug 2021 21:25:21 +0000 (17:25 -0400)
commit8960a29b18b830ff0490b7f52051903fba472e45
tree35a7a49679fa0b3925eb27ea96f7eaf295f5e535
parent729f6881cfcc6df3c15a1dd4ebd45bc46bb8f3e9
c++: limit instantiation with ill-formed class [PR96286]

I noticed that after the static_assert failures in lwg3466.cc, we got
various follow-on errors because we went ahead and tried to instantiate the
promise<T> member functions even after instantiating the class itself ran
into problems.  Interrupting instantiation of the class itself seems likely
to cause error-recovery problems, but preventing instantiation of member
functions seems strictly better for error-recovery.

This doesn't fix any of the specific testcases in PR96286, but addresses
part of that problem space.

PR c++/96286

gcc/cp/ChangeLog:

* cp-tree.h (struct lang_type): Add erroneous bit-field.
(CLASSTYPE_ERRONEOUS): New.
* pt.c (limit_bad_template_recursion): Check it.
(instantiate_class_template_1): Set it.

libstdc++-v3/ChangeLog:

* testsuite/30_threads/promise/requirements/lwg3466.cc:
Remove dg-prune-outputs.

gcc/testsuite/ChangeLog:

* g++.dg/template/access2.C: Split struct A.
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/access2.C
libstdc++-v3/testsuite/30_threads/promise/requirements/lwg3466.cc
This page took 0.064833 seconds and 5 git commands to generate.