From patchwork Thu Aug 4 00:02:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 655642 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3s4VWl3TYVz9stY for ; Thu, 4 Aug 2016 10:03:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=hzyWT/+/; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; q=dns; s=default; b=SisbrKv/XleVdzzY Q0ZVWC4tABbhDCDEq2qAKjVgIfrdS8vSlROLmCqdrhgeFdPbhdAQQ/3Nc6uE7xWk l0irUFYi1HtXnRH++TN+eNsXwkjzEI6b4fMbqzjbstG8N/0ONzdHQ6bL1baZ8qNF vXlm1YfcM28pnjKE4VqJG6ea4yY= 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 :date:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; s=default; bh=UhNbFHEgM2SeNZVmW18Pdd hH2AU=; b=hzyWT/+/x9y/EimzHuFU61cM5nBeVRuPjVl5Fp56eQ+fFUa7GDyGrV rZ+baPxEgwzusRPShAceRs//oxk+bi0ZmH5ZRXaRg2Ql4zMy2w4xkdoBhZdChqB/ WqPwCz/32awr2jKkJ2x/AGLMt9c4tcAy8e5z/oJYXOaYPd/B9L7aA= Received: (qmail 105472 invoked by alias); 4 Aug 2016 00:02:49 -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 105463 invoked by uid 89); 4 Aug 2016 00:02:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=H*Ad:D*cx X-HELO: mail-qt0-f180.google.com Received: from mail-qt0-f180.google.com (HELO mail-qt0-f180.google.com) (209.85.216.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 04 Aug 2016 00:02:36 +0000 Received: by mail-qt0-f180.google.com with SMTP id u25so151861307qtb.1 for ; Wed, 03 Aug 2016 17:02:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=RxGgNcoYw3g4kW4T97Z0ZIWp9cnx8t0yUwYq3p1QMh4=; b=d0decTw7NKWSJOCMQmdJWkxpcZ9Sr0XXr+bQGXhw4hZ+ntpTdf9Wejh/PXKL797yFz fq+vaw+cGZmv49qRybH0L47tCZ8hCjvb8HaZFbsl1NLx240ugvnFGvYcLY9iZFjqo4Ri Rfc7q0BIoBAEqGQHGnWATak5FBT/SoqLt42k+eiI2VsIDiwR8xQLboX/lXEVGnhjcA6w kMLuosSPlU+BXTyiir0BM2+C2LgGbbygXc/ZPEqB4mhU03fePVclXYuYzTjxd0Y5qzYN rNmMG2b1wdb6CVbK3oDwOvc+rMauua9bGMLyDhBll3bUZz/uV8e45psyeZDyFUUilK3U j0fQ== X-Gm-Message-State: AEkoous3tEX2CezFUAQgPSuXXSNAjR6Z1nvfaONuFQ9mmMupFaomvhVRfcTxVJyEZ0YalQ== X-Received: by 10.200.57.108 with SMTP id t41mr3231466qtb.33.1470268954106; Wed, 03 Aug 2016 17:02:34 -0700 (PDT) Received: from [192.168.1.130] (ool-4353abbc.dyn.optonline.net. [67.83.171.188]) by smtp.gmail.com with ESMTPSA id p188sm5497739qkf.6.2016.08.03.17.02.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Aug 2016 17:02:33 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Wed, 3 Aug 2016 20:02:32 -0400 (EDT) To: Jason Merrill cc: Patrick Palka , gcc-patches List Subject: Re: [PATCH] Fix ICE on invalid variable template instantiation (PR c++/72759) In-Reply-To: Message-ID: References: <20160802140607.4611-1-patrick@parcs.ath.cx> User-Agent: Alpine 2.20.13 (DEB 116 2015-12-14) MIME-Version: 1.0 On Wed, 3 Aug 2016, Jason Merrill wrote: > Why not check for error_mark_node right after the tsubst_template_args? No good reason. This seems to work too. Does the following look OK after bootstrap + regtest? -- >8 -- gcc/cp/ChangeLog: PR c++/72759 * pt.c (tsubst_qualified_id): Return error_mark_node if template_args is error_mark_node. gcc/testsuite/ChangeLog: PR c++/72759 * g++.dg/cpp1y/pr72759.C: New test. --- gcc/cp/pt.c | 2 ++ gcc/testsuite/g++.dg/cpp1y/pr72759.C | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr72759.C diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a23a05a..7663916 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13826,6 +13826,8 @@ tsubst_qualified_id (tree qualified_id, tree args, if (template_args) template_args = tsubst_template_args (template_args, args, complain, in_decl); + if (template_args == error_mark_node) + return error_mark_node; name = TREE_OPERAND (name, 0); } else diff --git a/gcc/testsuite/g++.dg/cpp1y/pr72759.C b/gcc/testsuite/g++.dg/cpp1y/pr72759.C new file mode 100644 index 0000000..4af6ea4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr72759.C @@ -0,0 +1,18 @@ +// PR c++/72759 +// { dg-do compile { target c++14 } } + +template struct SpecPerType; +class Specializer { + public: template static void MbrFnTempl(); + template struct A { static void InnerMemberFn(); }; + void Trigger() { A<0>::InnerMemberFn; } +}; +template <> struct SpecPerType { + using FnType = void *; + template + static constexpr FnType SpecMbrFnPtr = Specializer::MbrFnTempl

; +}; +template void Specializer::A::InnerMemberFn() { + using Spec = SpecPerType; + Spec ErrorSite = Spec::SpecMbrFnPtr; // { dg-error "not declared" } +}