From patchwork Thu Jun 16 21:48:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 100731 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]) by ozlabs.org (Postfix) with SMTP id B2A31B6F67 for ; Fri, 17 Jun 2011 07:48:42 +1000 (EST) Received: (qmail 1165 invoked by alias); 16 Jun 2011 21:48:41 -0000 Received: (qmail 1157 invoked by uid 22791); 16 Jun 2011 21:48:40 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jun 2011 21:48:27 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5GLmQRw028023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Jun 2011 17:48:27 -0400 Received: from [127.0.0.1] (ovpn-113-143.phx2.redhat.com [10.3.113.143]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5GLmQZk007960 for ; Thu, 16 Jun 2011 17:48:26 -0400 Message-ID: <4DFA7A2A.3010702@redhat.com> Date: Thu, 16 Jun 2011 17:48:26 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/49229 (ICE with substitution failure) 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 Another missing check for error_mark_node in SFINAE. Tested x86_64-pc-linux-gnu, applying to trunk. commit 2451aadf094bf8e65bf5a5fa28bbe3829c5a399e Author: Jason Merrill Date: Wed Jun 15 13:39:42 2011 -0400 PR c++/49229 * pt.c (tsubst_decl) [FUNCTION_DECL]: Handle substitution failure. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ff145a2..1008b3b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9548,6 +9548,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) (DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (t))), args, complain, in_decl); + if (argvec == error_mark_node) + RETURN (error_mark_node); /* Check to see if we already have this specialization. */ hash = hash_tmpl_and_args (gen_tmpl, argvec); diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae26.C b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C new file mode 100644 index 0000000..5b8cdd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C @@ -0,0 +1,38 @@ +// PR c++/49229 +// { dg-options -std=c++0x } + +extern void* enabler; + +template +struct enable_if {}; + +template +struct enable_if { + typedef T type; +}; + +template +struct and_; + +template +struct and_ : B1 {}; + +template +struct is_same { + static constexpr bool value = false; +}; + +template +struct is_same { + static constexpr bool value = true; +}; + +template +struct S { + template...>::value>::type*& = enabler + > + S(U...){} // # +}; + +S s(0); // { dg-error "no match" }