aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-09-14 16:55:04 +0200
committerJakub Jelinek <jakub@redhat.com>2021-09-14 16:55:04 +0200
commitf008fd3a480e3718436156697ebe7eeb47841457 (patch)
tree8730e0037a1d4b53d79d4be1d20c94e177d68573 /gcc/cp/method.c
parent33fdbbe4ce6055eb858096d01720ccf94aa854ec (diff)
downloadgcc-f008fd3a480e3718436156697ebe7eeb47841457.zip
gcc-f008fd3a480e3718436156697ebe7eeb47841457.tar.gz
gcc-f008fd3a480e3718436156697ebe7eeb47841457.tar.bz2
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.
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 353046d..32f7186 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -2081,6 +2081,7 @@ constructible_expr (tree to, tree from)
static tree
is_xible_helper (enum tree_code code, tree to, tree from, bool trivial)
{
+ to = complete_type (to);
deferring_access_check_sentinel acs (dk_no_deferred);
if (VOID_TYPE_P (to) || ABSTRACT_CLASS_TYPE_P (to)
|| (from && FUNC_OR_METHOD_TYPE_P (from)