diff mbox

git repository for constexpr (was Re: C++ PATCH for constexpr)

Message ID 4C406694.5060005@redhat.com
State New
Headers show

Commit Message

Jason Merrill July 16, 2010, 2:03 p.m. UTC
On 07/14/2010 01:36 PM, Jason Merrill wrote:
> On 05/06/2010 10:14 PM, Jason Merrill wrote:
>> I've set up a git repository for constexpr work: the web interface is at
>>
>> http://repo.or.cz/w/official-gcc/constexpr.git
>
> It occurred to me that it wasn't really necessary to use a third-party
> site; I have now added a "constexpr" branch to the official git mirror
> (http://gcc.gnu.org/wiki/GitMirror).

I've now updated this branch to current trunk, with no regressions.  I 
needed to apply this patch to avoid some regressions on initlist tests.
diff mbox

Patch

commit af4de5b1df1cb3ffb8148fcb7b8f0258ee5e717f
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jul 16 00:47:54 2010 -0400

    fix initlist tests

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5d64075..c6140dc 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5930,7 +5930,9 @@  implicit_dereference_p (tree t)
 static bool
 implicit_address_p (tree t)
 {
-  if (TREE_CODE (t) == NOP_EXPR)
+  if (TREE_CODE (t) != NOP_EXPR
+      || TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE)
+    return false;
     switch (TREE_CODE (TREE_OPERAND (t, 0)))
       {
       case ADDR_EXPR:
@@ -5947,7 +5949,6 @@  implicit_address_p (tree t)
       default:
         return false;
       }
-  return false;
 }
 
 
@@ -5984,7 +5985,8 @@  cxx_eval_constant_expression (const constexpr_call *call, tree t)
       return cxx_eval_constant_expression (call, TREE_OPERAND (t, 0));
 
     case ADDR_EXPR:
-      if (TREE_STATIC (TREE_OPERAND (t, 0)))
+      if (TREE_STATIC (TREE_OPERAND (t, 0))
+	  || DECL_EXTERNAL (TREE_OPERAND (t, 0)))
         return t;
       error ("address of object %qE with non-static storage is "
              " not a constant expression", t);
@@ -6097,10 +6099,9 @@  cxx_eval_constant_expression (const constexpr_call *call, tree t)
               }
             return cxx_eval_constant_expression (call, t);
           }
-        t =  cp_convert
+        return cp_convert
           (TREE_TYPE (t),
            cxx_eval_constant_expression (call, TREE_OPERAND (t, 0)));
-        return cxx_eval_constant_expression (call, t);
       }
       
     case CONVERT_EXPR: