OSDN Git Service

PR c++/48535
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Apr 2011 22:00:53 +0000 (22:00 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Apr 2011 22:00:53 +0000 (22:00 +0000)
* semantics.c (finish_compound_literal): Handle references.

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

gcc/cp/ChangeLog
gcc/cp/semantics.c

index 6732794..d5975fc 100644 (file)
@@ -1,6 +1,9 @@
 2011-04-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/48535
+       * semantics.c (finish_compound_literal): Handle references.
+
+       PR c++/48535
        * semantics.c (finish_compound_literal): Take complain parm.
        (build_lambda_object): Adjust.
        * cp-tree.h: Adjust.
index e08ddb3..461aa0a 100644 (file)
@@ -2315,6 +2315,14 @@ finish_compound_literal (tree type, tree compound_literal,
   if (type == error_mark_node)
     return error_mark_node;
 
+  if (TREE_CODE (type) == REFERENCE_TYPE)
+    {
+      compound_literal
+       = finish_compound_literal (TREE_TYPE (type), compound_literal,
+                                  complain);
+      return cp_build_c_cast (type, compound_literal, complain);
+    }
+
   if (!TYPE_OBJ_P (type))
     {
       if (complain & tf_error)