From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4A7323858433 for ; Wed, 22 Mar 2023 19:30:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4A7323858433 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679513424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iEssKp7xDRFuhSx4dLIF9Ldtvb7TYvGQmF6cxXwY8Ig=; b=cxjvr67IXFTLcU7Kv/sI66QNv/yqVrPTfx1yqy9zM/JcZXOaAOZGnNhgGhitEswHV2GWDL HKQpzr3A2aWQPZiFm45ks8kgjN+9X3zuR4RNwwcpsyZr4yJu/Ly6lOYEcPxJS4VCr5m6Qw 4HZ6aV+cfmoBYJ8ry+mbWEfexX/HHZg= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-118-1wv9AveXPVSjrT7iOhxANg-1; Wed, 22 Mar 2023 15:30:22 -0400 X-MC-Unique: 1wv9AveXPVSjrT7iOhxANg-1 Received: by mail-qv1-f72.google.com with SMTP id oo15-20020a056214450f00b005a228adfcefso9897456qvb.2 for ; Wed, 22 Mar 2023 12:30:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679513421; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iEssKp7xDRFuhSx4dLIF9Ldtvb7TYvGQmF6cxXwY8Ig=; b=AcCZ21gwvDI8LNf5eQr5cy01IoEh3aUT7BagIFp42l/ZMQ+EfCxX2tpZaqbje8HT45 czzb+6gSBhp92N1JyqoapI8qp4gv17+pPBne6i7Au3T57mYNLYK3YPRyPUfnr/6Atdus A5wb6fNpmj/LWYYs4LMCEGaRXv0nN096JWyI+tZ4Unc45HBD6mbXFISK48gAPMjPAq7N AT//KOdPlCqR2OktZt8aPyLc/UNUEpRSB1qVSfDBTAVHv6BbJg9Vm88Q4vsFycSENr1z UHxTO4wlyQRjkZK5Dgf0m/qlsuUXg1zGUHwpgORKEQiwmb7FSvdewCH9od4VCS7mjJTG N9Rg== X-Gm-Message-State: AO0yUKVFdLGpYStDpA7ha3dZgIxtPo04hoKj6S2a1Ml9ydRUll+duk/z UuN6f79AU9+IJaByMmqI8Aoy/vrbT9xraDuoXUkXCOSjFa0pze0WP9u+dalI9UDINtmegs5PosI +Tgb2XekITAkKhN5KzWmL3lbB8pVWjRIscShN6wOAkF5pYMXC5W2KpljkXNvnTNvLlNcIQWQoTQ == X-Received: by 2002:ac8:588c:0:b0:3bf:cff2:2c2f with SMTP id t12-20020ac8588c000000b003bfcff22c2fmr7701994qta.44.1679513421551; Wed, 22 Mar 2023 12:30:21 -0700 (PDT) X-Google-Smtp-Source: AK7set81V6pWMoBToKlEUbjm+HiWHcDVAkrsY6vSWBddJTrXPOhUolYqdg42+cEDZOKQA8pkgBXk7Q== X-Received: by 2002:ac8:588c:0:b0:3bf:cff2:2c2f with SMTP id t12-20020ac8588c000000b003bfcff22c2fmr7701944qta.44.1679513421091; Wed, 22 Mar 2023 12:30:21 -0700 (PDT) Received: from jason.cygnus.com (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id x23-20020ac87317000000b003b63b8df24asm3988408qto.36.2023.03.22.12.30.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 12:30:20 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: array bound partial ordering [PR108390] Date: Wed, 22 Mar 2023 15:30:16 -0400 Message-Id: <20230322193016.2560128-1-jason@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- fold_convert doesn't work with a dependent argument, and problematically differed from the corresponding fold+build_nop further down in the function. So change it to match. PR c++/108390 gcc/cp/ChangeLog: * pt.cc (unify): Use fold of build_nop instead of fold_convert. gcc/testsuite/ChangeLog: * g++.dg/template/partial-order3.C: New test. --- gcc/cp/pt.cc | 8 +++++--- gcc/testsuite/g++.dg/template/partial-order3.C | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/partial-order3.C diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 056b8c7abad..90bcaa78701 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -24635,8 +24635,9 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, if ((strict & UNIFY_ALLOW_INTEGER) && TREE_TYPE (targ) && TREE_TYPE (arg) && CP_INTEGRAL_TYPE_P (TREE_TYPE (targ))) - /* We're deducing from an array bound, the type doesn't matter. */ - arg = fold_convert (TREE_TYPE (targ), arg); + /* We're deducing from an array bound, the type doesn't matter. + This conversion should match the one below. */ + arg = fold (build_nop (TREE_TYPE (targ), arg)); int x = !cp_tree_equal (targ, arg); if (x) unify_inconsistency (explain_p, parm, targ, arg); @@ -24684,7 +24685,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, && CP_INTEGRAL_TYPE_P (tparm)) /* Convert the ARG to the type of PARM; the deduced non-type template argument must exactly match the types of the - corresponding parameter. */ + corresponding parameter. This conversion should match the + one above. */ arg = fold (build_nop (tparm, arg)); else if (uses_template_parms (tparm)) { diff --git a/gcc/testsuite/g++.dg/template/partial-order3.C b/gcc/testsuite/g++.dg/template/partial-order3.C new file mode 100644 index 00000000000..154505321bf --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial-order3.C @@ -0,0 +1,6 @@ +// PR c++/108390 +// { dg-do compile { target c++11 } } + +template long f(int(*)[t], T(*)[t]); +template int f(int(*)[i], T(*)[i]) = delete; +int n = f(0, 0); base-commit: 3e791f45ded89626bc1f9f8013728f6e035801b2 -- 2.31.1