]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (grok_reference_init): Handle constexpr here.
authorJason Merrill <jason@redhat.com>
Sat, 13 Aug 2011 20:03:15 +0000 (16:03 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 13 Aug 2011 20:03:15 +0000 (16:03 -0400)
* decl.c (grok_reference_init): Handle constexpr here.
* call.c (initialize_reference): Not here.

From-SVN: r177734

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

index bb6d614fb3ca93c4a4959175073550971a20020d..bc33588f9d393e5e440c6a02080551fe892e6752 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 e8fb68d833a658fd5ef74cee0780493fcd6fea07..d2700cbeac808bb3b06b3d552f07533118e27715 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 1db074809c8ffbf28f8d438aa03832aa40ee05cd..c125f05478e97b957c6b3d7239b6792b6017f5ab 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;