]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix __is_*constructible/assignable for templates [PR102305]
authorJakub Jelinek <jakub@redhat.com>
Tue, 14 Sep 2021 14:55:04 +0000 (16:55 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 10 May 2022 08:14:27 +0000 (10:14 +0200)
commit269c6ed92a7dcfdacfa4a7ade2dc0616928b9b9b
tree8850f5f8b6408a22d8aae23f89890b751df70cd5
parentc7b00fbc469bc9c0a486b48bc349dba13881241e
c++: Fix __is_*constructible/assignable for templates [PR102305]

is_xible_helper returns error_mark_node (i.e. false from the traits)
for abstract classes by testing ABSTRACT_CLASS_TYPE_P (to) early.
Unfortunately, as the testcase shows, that doesn't work on class templates
that haven't been instantiated yet, ABSTRACT_CLASS_TYPE_P for them is false
until it is instantiated, which is done when the routine later constructs
a dummy object with that type.

The following patch fixes this by calling complete_type first, so that
ABSTRACT_CLASS_TYPE_P test will work properly, while keeping the handling
of arrays with unknown bounds, or incomplete types where it is done
currently.

2021-09-14  Jakub Jelinek  <jakub@redhat.com>

PR c++/102305
* method.c (is_xible_helper): Call complete_type on to.

* g++.dg/cpp0x/pr102305.C: New test.

(cherry picked from commit f008fd3a480e3718436156697ebe7eeb47841457)
gcc/cp/method.c
gcc/testsuite/g++.dg/cpp0x/pr102305.C [new file with mode: 0644]