From patchwork Wed Dec 11 16:47:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1207764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515699-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RqCwhBXo"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="ElHZly1Z"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Y2sY1cYHz9sVH for ; Thu, 12 Dec 2019 03:47:23 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding; q=dns; s=default; b=cKwQMzk4XcEqWebX MVK96Vc+t+YWjtRwvwKc31jd8ttgxkwrCFR+Le7UmOaMGYScWH8eIwaWQvRiI2qA 5+xzwIGj/FvsKLL0YaF3VgN8/9Lv9BmZMZf9JYBMmZmu9Zpz+hXmu5GXYx8Vau8x MDFssgSUhUlZeRFOeR+tG/F8ys4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding; s=default; bh=EHJNs5OeJaJbQV/gfRablD fECoI=; b=RqCwhBXouNzOaz5bkJxCdfDQxfwTe2vlc7PlVCFZ7Hyza67c0IqFk0 xlD+6KlhfaN0CfZd3i9IAGuBRivDBz+C84d72yeTR9BbKxF+eEV9mLkk83edCutT Tn9SOA3Cxg/TlMxjVi+MfnnoCA5nzxXZrPi7ft6wRKL/734mH9/1A= Received: (qmail 103453 invoked by alias); 11 Dec 2019 16:47:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 103445 invoked by uid 89); 11 Dec 2019 16:47:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Dec 2019 16:47:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576082832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SbNDoz/qI4kKvFcJtkIzg68Kd+DWtu7mmuFmFMMgipY=; b=ElHZly1ZrlZZZ//M7g1T3m+8TksZec8AM5N8hP/ZIy880DWWVPhnoMZx2tA0QumUC8OB22 /id9bxbMAiURa3nrJONeFofbACDmqbPZ2dWJlyNaWBAWtXE9+1oX2WHjGNm6KOBjzYxY4E kRfCkfPuiSJE95OFZi0OevXg3vWntxA= 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-424-p-4CJ-2uOBawnmAzG-F7Qg-1; Wed, 11 Dec 2019 11:47:11 -0500 Received: by mail-qt1-f199.google.com with SMTP id d9so4764562qtq.13 for ; Wed, 11 Dec 2019 08:47:11 -0800 (PST) Received: from barrymore.redhat.com (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id o6sm811760qkk.53.2019.12.11.08.47.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 08:47:09 -0800 (PST) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] PR c++/92446 - deduction of class NTTP. Date: Wed, 11 Dec 2019 11:47:08 -0500 Message-Id: <20191211164708.22749-1-jason@redhat.com> X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes Another place we need to look through the VIEW_CONVERT_EXPR we add to make a use of a class NTTP have const type. Tested x86_64-pc-linux-gnu, applying to trunk. * pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR. --- gcc/cp/pt.c | 2 +- gcc/testsuite/g++.dg/cpp2a/nontype-class26.C | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class26.C base-commit: 945f2b19497eff52ef44923d291bf0fdba043299 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d8ab26ec675..6f658de28ed 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21183,7 +21183,7 @@ static bool deducible_expression (tree expr) { /* Strip implicit conversions. */ - while (CONVERT_EXPR_P (expr)) + while (CONVERT_EXPR_P (expr) || TREE_CODE (expr) == VIEW_CONVERT_EXPR) expr = TREE_OPERAND (expr, 0); return (TREE_CODE (expr) == TEMPLATE_PARM_INDEX); } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class26.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class26.C new file mode 100644 index 00000000000..315e0ac2309 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class26.C @@ -0,0 +1,13 @@ +// { dg-do compile { target c++2a } } + +struct p { unsigned p_ {}; }; + +template

struct pp {}; +struct qq : public pp

{}; + +template

int f (pp const &); + +int main () +{ + return f (qq {}); +}