diff mbox

C++ PATCH for c++/49134 (constexpr failures on ARM)

Message ID 4DEC5494.3060601@redhat.com
State New
Headers show

Commit Message

Jason Merrill June 6, 2011, 4:16 a.m. UTC
build_target_expr was making the assumption that the initializer for a 
temporary should have the same type as the temporary, but that isn't the 
case on ARM, where the ABI is changed to return 'this' from 
constructors.  So I adjusted the assert.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.
diff mbox

Patch

commit 36e8e35be7b42ec47b46364a385accfc8af9e93b
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 2 14:35:53 2011 -0400

    	PR c++/49134
    	* tree.c (build_target_expr): Deal with ARM ABI tweaks.

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 11e195e..025fe2d 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -292,6 +292,9 @@  build_target_expr (tree decl, tree value, tsubst_flags_t complain)
 #ifdef ENABLE_CHECKING
   gcc_assert (VOID_TYPE_P (TREE_TYPE (value))
 	      || TREE_TYPE (decl) == TREE_TYPE (value)
+	      /* On ARM ctors return 'this'.  */
+	      || (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
+		  && TREE_CODE (value) == CALL_EXPR)
 	      || useless_type_conversion_p (TREE_TYPE (decl),
 					    TREE_TYPE (value)));
 #endif