diff mbox

C++ PATCH for c++/46298 (constexpr ICE on ARM)

Message ID 4CD3188D.3060207@redhat.com
State New
Headers show

Commit Message

Jason Merrill Nov. 4, 2010, 8:33 p.m. UTC
constexpr constructors were completely broken on ARM, because of the 
different C++ ABI (ctors return 'this').  Fixed thus.

Tested x86_64-pc-linux-gnu, applied to trunk.  No additional testcase 
needed.
commit fd843ffe152fc652a09cf065a0aa1b246a6ce2c4
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Nov 4 15:52:00 2010 -0400

    	PR c++/46298
    	* semantics.c (build_constexpr_constructor_member_initializers):
    	Handle an enclosing STATEMENT_LIST.

Comments

Gabriel Dos Reis Nov. 4, 2010, 11:01 p.m. UTC | #1
On Thu, Nov 4, 2010 at 3:33 PM, Jason Merrill <jason@redhat.com> wrote:
> constexpr constructors were completely broken on ARM, because of the
> different C++ ABI (ctors return 'this').  Fixed thus.
>

Sorry about that.

-- Gaby
diff mbox

Patch

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 3d62cd1..558be88 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5535,8 +5535,9 @@  build_constexpr_constructor_member_initializers (tree type, tree body)
   if (TREE_CODE (body) == MUST_NOT_THROW_EXPR
       || TREE_CODE (body) == EH_SPEC_BLOCK)
     body = TREE_OPERAND (body, 0);
-  if (TREE_CODE (body) == BIND_EXPR)
-    body = BIND_EXPR_BODY (body);
+  if (TREE_CODE (body) == STATEMENT_LIST)
+    body = STATEMENT_LIST_HEAD (body)->stmt;
+  body = BIND_EXPR_BODY (body);
   if (TREE_CODE (body) == CLEANUP_POINT_EXPR)
     ok = build_data_member_initialization (body, &vec);
   else if (TREE_CODE (body) == STATEMENT_LIST)