From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10328 invoked by alias); 3 Jan 2013 20:36:13 -0000 Received: (qmail 9966 invoked by uid 22791); 3 Jan 2013 20:36:09 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,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, 03 Jan 2013 20:36:02 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r03Ka2dd000329 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 3 Jan 2013 15:36:02 -0500 Received: from [10.3.113.59] (ovpn-113-59.phx2.redhat.com [10.3.113.59]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r03Ka1XF025491 for ; Thu, 3 Jan 2013 15:36:02 -0500 Message-ID: <50E5EBB1.8020507@redhat.com> Date: Thu, 03 Jan 2013 20:36:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/55753 (ICE with constexpr) Content-Type: multipart/mixed; boundary="------------030902030202020600020802" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg00140.txt.bz2 This is a multi-part message in MIME format. --------------030902030202020600020802 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 215 This is a bit I missed in my 55419 patch; if we aren't setting TREE_CONSTANT on TARGET_EXPRs in the constexpr code, we can't expect it in the template code. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. --------------030902030202020600020802 Content-Type: text/x-patch; name="55753.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="55753.patch" Content-length: 1232 commit db160eb9b07b62f3696e7358c74e6d59c68385d8 Author: Jason Merrill Date: Thu Jan 3 14:43:05 2013 -0500 PR c++/55419 PR c++/55753 * pt.c (tsubst_copy_and_build) [TARGET_EXPR]: Don't touch TREE_CONSTANT. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1b3f039..09a0aa5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14333,11 +14333,9 @@ tsubst_copy_and_build (tree t, case TARGET_EXPR: /* We can get here for a constant initializer of non-dependent type. FIXME stop folding in cp_parser_initializer_clause. */ - gcc_assert (TREE_CONSTANT (t)); { tree r = get_target_expr_sfinae (RECUR (TARGET_EXPR_INITIAL (t)), complain); - TREE_CONSTANT (r) = true; RETURN (r); } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C new file mode 100644 index 0000000..a5a4b4d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C @@ -0,0 +1,14 @@ +// PR c++/55753 +// { dg-options -std=c++11 } + +template +struct C { + constexpr C(const Tp& r) { } +}; + +template +struct B { + B() { + C cpl = C((true ? 1.0 : C())); + } +}; --------------030902030202020600020802--