From patchwork Thu Mar 5 15:52:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1249675 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-520716-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.a=rsa-sha1 header.s=default header.b=SDykY2Ls; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dAs87CIo; 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 48YFdD05Hqz9sPg for ; Fri, 6 Mar 2020 02:52:46 +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=PHDWhCARudd6gpqs GbKrVsPyeOLJOoKuD3/6iE6HXA/8NFyBqN/t/B/2cZzto5REkBqa3Sp7jBD8VmTv 0eXfb697En/iZvmogy0XXnZ1AUPhjmvi+GhzM4e6waZHG2BHpJ/tblQbCBNddNYD pnSM7Em4MwplulFggFWZ6I7SKR0= 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=lcUifr1C/eXWVtX4vNcov4 dGKgg=; b=SDykY2Lsmrc0s2vW72/I6KmIekrzM1E08nc3vpI/7QN+bZGO9YuAlz 16hN5hHDo7mXonLnLwyeHQdBQru80qoln2TjKRFL9MlX7WbcDOQ4qOPto+VsMdEV M6hMBkWQirBt5FQ9h0UTWFI4/wBrn6620VGqvxFiGpGMgbBuUcCvQ= Received: (qmail 6586 invoked by alias); 5 Mar 2020 15:52:40 -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 6578 invoked by uid 89); 5 Mar 2020 15:52:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE 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) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Mar 2020 15:52:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583423557; 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=921Ipa571FDoQsJ5rCrjGRWNFrhsH+JfHsCLv21hSNo=; b=dAs87CIo/IUAKk9DgqKjvXw1GqGRkHZQIo/NQfOFn9kJ4j2BOljnW1g4TrSwS5N4rMjwzv 08emTQmN+ShuEOfgbknWjfn8W+aP0lphnuLwllYpV6Wd1mab5jPEr/DqgX3Xyk0+lyq6zx mSLhu8pez6iCt4wVYOY+HHuKxC521Z8= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-301-pvlQBQr1PTeELj6c_POfhw-1; Thu, 05 Mar 2020 10:52:35 -0500 Received: by mail-qt1-f197.google.com with SMTP id o9so4097976qtt.8 for ; Thu, 05 Mar 2020 07:52:35 -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 f5sm13765171qka.43.2020.03.05.07.52.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 07:52:33 -0800 (PST) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed GCC9] c++: Fix SFINAE for invalid non-type tparm types. Date: Thu, 5 Mar 2020 10:52:32 -0500 Message-Id: <20200305155232.28728-1-jason@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes Just missing the usual SFINAE pattern here. This was fixed for GCC 10 as a drive-by in r277902. gcc/cp/ChangeLog 2020-03-05 Jason Merrill PR c++/90338 * pt.c (invalid_nontype_parm_type_p): Check complain for non-literal and mutable errors. --- gcc/cp/pt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 43d9660ebda..4787747b6ff 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25341,15 +25341,20 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) return true; if (!literal_type_p (type)) { - error ("%qT is not a valid type for a template non-type parameter " - "because it is not literal", type); - explain_non_literal_class (type); + if (complain & tf_error) + { + auto_diagnostic_group d; + error ("%qT is not a valid type for a template non-type parameter " + "because it is not literal", type); + explain_non_literal_class (type); + } return true; } if (cp_has_mutable_p (type)) { - error ("%qT is not a valid type for a template non-type parameter " - "because it has a mutable member", type); + if (complain & tf_error) + error ("%qT is not a valid type for a template non-type parameter " + "because it has a mutable member", type); return true; } /* FIXME check op<=> and strong structural equality once spaceship is