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 D0D803858D37 for ; Fri, 22 Sep 2023 14:36:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0D803858D37 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=1695393370; 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: in-reply-to:in-reply-to:references:references; bh=pXOXvfhSoSk7BsokZwzv0MW+zCb06FpKbjVKjpMIqtk=; b=HojTu0fKGe1UIbRG5HMKObf51hdQ57yQgUKhdPc8bF3HxPgpvFPcg/ChF2EW0VQ42Q/k/4 IlXNucEmRQoBNeBD4ApnvLnlucE+Y44W9wyGQMghOqkIRVKZhjSPCykDEYfOnrA6CU0CRT 57VCSlo1bIIziA39jvx1xvX4YccrQrM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-392-r5ASwdiaNqSFfpfjiqNhIg-1; Fri, 22 Sep 2023 10:36:08 -0400 X-MC-Unique: r5ASwdiaNqSFfpfjiqNhIg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-402cd372b8bso17040815e9.2 for ; Fri, 22 Sep 2023 07:36:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695393367; x=1695998167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pXOXvfhSoSk7BsokZwzv0MW+zCb06FpKbjVKjpMIqtk=; b=I7aR7dvCuuKze6OyI73pUppq7WmDzvOtN5Sjs/n/UA4V5OSR74XHPAjMoPltyhppMe IDxdqmriAre2hrQKK0ndpLXHJi8hgQrhi2GbyRIt7QKk9Jl6s+0YoeFdZ+knebweVC6h wrkgSga3Y/bJ0+jM5hKEMfrQ0cNTCS6C6h+daziVmZvtfRML1qAhxqTuM0mnKduy7FA4 epmILYiZI5d+dLGIJd+WXIexSvj1ZYB19ycFo9nqtTGy3nqqK0g4WW9072kQc5rdQ2j4 3mTj32nlMUe7IHdZQWr3atXu0pAte/tBsV0xxV3bgFUuoxEGeHikylUqx8L1miiynbLU xajQ== X-Gm-Message-State: AOJu0YyaE5vLenWvxeWKjfj6xMI5c1hIJRwlb0lLDyXQnWeX1tVFUWhD Q4kdIQbdZXQ4p3+ZVJeN6n7ATx9HZovaFjSpa9zSMbwK7vfwgTn9Zw5qblNhCzy9RMqVH3caJU2 q2XIKoQF3gttaTwA96ow2L5qvI24cdD4JoVgDIYFBDzL7QF3iYS717fq9pzMQv3qIS2TTgPJZOI h1 X-Received: by 2002:adf:d0c8:0:b0:31f:d8b3:ea06 with SMTP id z8-20020adfd0c8000000b0031fd8b3ea06mr7856496wrh.0.1695393366868; Fri, 22 Sep 2023 07:36:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSBkiEJlbIkWAZF8VfwrDBq73bEDIS7NlKRmri/WavjEzie7ieQB95oD9yOzwhX4NNOKRAXg== X-Received: by 2002:adf:d0c8:0:b0:31f:d8b3:ea06 with SMTP id z8-20020adfd0c8000000b0031fd8b3ea06mr7856475wrh.0.1695393366399; Fri, 22 Sep 2023 07:36:06 -0700 (PDT) Received: from jason.com ([195.89.33.213]) by smtp.gmail.com with ESMTPSA id g7-20020a5d46c7000000b0031fbbe347e1sm4635105wrs.65.2023.09.22.07.36.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 07:36:05 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed] c++ __integer_pack conversion again [PR111357] Date: Fri, 22 Sep 2023 15:35:57 +0100 Message-Id: <20230922143557.263703-1-jason@redhat.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: 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.4 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_H3,RCVD_IN_MSPIKE_WL,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< -- As Jakub pointed out, the real problem here is that in a partial substitution we're forgetting the conversion to the type of the non-type template argument, because maybe_convert_nontype_argument doesn't do anything with value-dependent arguments. I'm experimenting with changing that, but in the meantime we can work around it here. PR c++/111357 gcc/cp/ChangeLog: * pt.cc (expand_integer_pack): Use IMPLICIT_CONV_EXPR. --- gcc/cp/pt.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index ea5379098a5..73ac1cb597c 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -3769,6 +3769,13 @@ expand_integer_pack (tree call, tree args, tsubst_flags_t complain, { if (hi != ohi) { + /* Work around maybe_convert_nontype_argument not doing this for + dependent arguments. Don't use IMPLICIT_CONV_EXPR_NONTYPE_ARG + because that will make tsubst_copy_and_build ignore it. */ + tree type = tsubst (TREE_TYPE (ohi), args, complain, in_decl); + if (!TREE_TYPE (hi) || !same_type_p (type, TREE_TYPE (hi))) + hi = build1 (IMPLICIT_CONV_EXPR, type, hi); + call = copy_node (call); CALL_EXPR_ARG (call, 0) = hi; } @@ -3779,8 +3786,6 @@ expand_integer_pack (tree call, tree args, tsubst_flags_t complain, } else { - hi = perform_implicit_conversion_flags (integer_type_node, hi, complain, - LOOKUP_IMPLICIT); hi = instantiate_non_dependent_expr (hi, complain); hi = cxx_constant_value (hi, complain); int len = valid_constant_size_p (hi) ? tree_to_shwi (hi) : -1; base-commit: 22cda0ca5fb406f22925bbf51ab152a958e3319d -- 2.39.3