From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11753 invoked by alias); 7 May 2012 09:51:18 -0000 Received: (qmail 11742 invoked by uid 22791); 7 May 2012 09:51:17 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 May 2012 09:51:05 +0000 From: "paolo.carlini at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52282] [C++0x] ICE / confused by earlier errors with decltype/constexpr Date: Mon, 07 May 2012 10:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: paolo.carlini at oracle dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg00703.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52282 Paolo Carlini changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-05-07 CC| |paolo.carlini at oracle dot | |com Ever Confirmed|0 |1 --- Comment #6 from Paolo Carlini 2012-05-07 09:50:43 UTC --- For concreteness, with the below patchlet (for the record, about the cxx_eval_call_expression bits, in build_data_member_initialization we have something quite similar) all the test pass, besides the four lines: static_assert((c.*W_::value)() == 10, "oops"); static_assert((c.*X_::value)() == 10, "oops"); static_assert((c.*Y_::value)() == 10, "oops"); static_assert((c.*Z_::value)() == 10, "oops"); /////////////// Index: semantics.c =================================================================== --- semantics.c (revision 187228) +++ semantics.c (working copy) @@ -5269,6 +5269,7 @@ finish_decltype_type (tree expr, bool id_expressio case INTEGER_CST: case PTRMEM_CST: + case ADDR_EXPR: /* We can get here when the id-expression refers to an enumerator or non-type template parameter. */ type = TREE_TYPE (expr); @@ -6488,6 +6489,12 @@ cxx_eval_call_expression (const constexpr_call *ol /* Might be a constexpr function pointer. */ fun = cxx_eval_constant_expression (old_call, fun, allow_non_constant, /*addr*/false, non_constant_p); + if (TREE_CODE (fun) == NOP_EXPR) + { + tree tmp = fun; + STRIP_NOPS (tmp); + fun = tmp; + } if (TREE_CODE (fun) == ADDR_EXPR) fun = TREE_OPERAND (fun, 0); }