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 [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id CAE5F386F47E for ; Thu, 7 Jan 2021 21:06:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CAE5F386F47E Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-58-y__wsY17OZmQxWDQzyVlgA-1; Thu, 07 Jan 2021 16:06:47 -0500 X-MC-Unique: y__wsY17OZmQxWDQzyVlgA-1 Received: by mail-qt1-f199.google.com with SMTP id z43so6472854qtb.0 for ; Thu, 07 Jan 2021 13:06:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8cCZnO3esokr6jRW0OHC9EPlt9yYl385Us6MzN5Anyg=; b=b2PnNgHkmyUPQZacU8m7+pV9ZQUXbhJxJBijZv6TI6Ly97DgCnmDYARlAsNxfiYiVZ 7lCZ1s/yp9wOYRXJdJLQiN6lO7FO98qqyxEuGcBewRg0YShqqsHvmJZ01tVeK/BKpBdj 8haFWV+gJ6Jx+bNu+lnjHSFwrYAdWcbrHYszxTCqt4XnZlXje55edFYwD3IjeO2kyphV Do7lnEsSB17PcFNOhglYKOo37TAvKjJjCaaoXYPoJDQ0C5x+oye9XODr/8L9du56cYYP BWlQ5nGPcScJGn5ew7CtHikPy9bravx6TFmk20RnZXSXqP+Td8nFKzrcT2THEuwsvnNX H9aw== X-Gm-Message-State: AOAM532sqLENOrKnmxmMhDmyiXD82cTJbPORZLMi07SKuMb6VmZlmHvP zAFTnYSNgy3pOsLsDJ/3Wgjufw2JhJo92PxxkUIZkkSgVMgd/EVI3PqXBPT/HBEwRHJYguUoLph 9L0l1tQ2pSW/rO/EUoSymXpPaVBTT+RvUeModK5gyxZaRLsq6baUbhKet6OgUXU989o0= X-Received: by 2002:a05:620a:144b:: with SMTP id i11mr924645qkl.178.1610053606563; Thu, 07 Jan 2021 13:06:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWVmWKdYEH+X674I6pLkEJafL1i+wHIPLHyCEdO4h6TJL+VIwPFQomPaZgg/94W4tGiqgRvw== X-Received: by 2002:a05:620a:144b:: with SMTP id i11mr924616qkl.178.1610053606273; Thu, 07 Jan 2021 13:06:46 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id h21sm3811609qkk.5.2021.01.07.13.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 13:06:45 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: ICE with constrained placeholder return type [PR98346] Date: Thu, 7 Jan 2021 16:06:42 -0500 Message-Id: <20210107210642.2100999-1-ppalka@redhat.com> X-Mailer: git-send-email 2.30.0 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-Spam-Status: No, score=-16.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_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 21:06:49 -0000 This is essentially a followup to r11-3714 -- we ICEing from another "unguarded" call to build_concept_check, this time in do_auto_deduction, due to the presence of templated trees when !processing_template_decl. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk and perhaps the 10 branch? gcc/cp/ChangeLog: PR c++/98346 * pt.c (do_auto_deduction): Temporarily increment processing_template_decl before calling build_concept_check. gcc/testsuite/ChangeLog: PR c++/98346 * g++.dg/cpp2a/concepts-placeholder3.C: New test. --- gcc/cp/pt.c | 2 ++ .../g++.dg/cpp2a/concepts-placeholder3.C | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-placeholder3.C diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index beabcc4b027..111a694e0c5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -29464,7 +29464,9 @@ do_auto_deduction (tree type, tree init, tree auto_node, cargs = targs; /* Rebuild the check using the deduced arguments. */ + ++processing_template_decl; check = build_concept_check (cdecl, cargs, tf_none); + --processing_template_decl; if (!constraints_satisfied_p (check)) { diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder3.C new file mode 100644 index 00000000000..a5d0b1e1d0f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder3.C @@ -0,0 +1,15 @@ +// PR c++/98346 +// { dg-do compile { target c++20 } } + +template +concept always_satisfied = true; + +using arg_alias = int; + +template +using result_of = decltype(F{}(arg_alias{})); + +template +always_satisfied> auto foo(F) {} + +void bar() { foo(0); } -- 2.30.0