OSDN Git Service

* decl.c (grok_reference_init): Handle constexpr here.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Aug 2011 20:03:15 +0000 (20:03 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Aug 2011 20:03:15 +0000 (20:03 +0000)
* call.c (initialize_reference): Not here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177734 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/decl.c

index bb6d614..bc33588 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-13  Jason Merrill  <jason@redhat.com>
+
+       * decl.c (grok_reference_init): Handle constexpr here.
+       * call.c (initialize_reference): Not here.
+
 2011-08-12  Jason Merrill  <jason@redhat.com>
 
        PR c++/50034
index e8fb68d..d2700cb 100644 (file)
@@ -8820,12 +8820,6 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup,
                    (build_pointer_type (base_conv_type), expr,
                     complain));
          expr = build_nop (type, expr);
-         if (DECL_DECLARED_CONSTEXPR_P (decl))
-           {
-             expr = cxx_constant_value (expr);
-             DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)
-               = reduced_constant_expression_p (expr);
-           }
        }
     }
   else
index 1db0748..c125f05 100644 (file)
@@ -4597,6 +4597,12 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
      explicitly); we need to allow the temporary to be initialized
      first.  */
   tmp = initialize_reference (type, init, decl, cleanup, tf_warning_or_error);
+  if (DECL_DECLARED_CONSTEXPR_P (decl))
+    {
+      tmp = cxx_constant_value (tmp);
+      DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)
+       = reduced_constant_expression_p (tmp);
+    }
 
   if (tmp == error_mark_node)
     return NULL_TREE;