re PR c++/48535 ([C++0x][SFINAE] Hard errors during list-value-initialization)
authorJason Merrill <jason@redhat.com>
Mon, 11 Apr 2011 22:00:53 +0000 (18:00 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 11 Apr 2011 22:00:53 +0000 (18:00 -0400)
PR c++/48535
* semantics.c (finish_compound_literal): Handle references.

From-SVN: r172286

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

index 6732794f4be2da70a10293848038cc5236e20748..d5975fcfbadfc9df602e9a33966058a637981613 100644 (file)
@@ -1,5 +1,8 @@
 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.
index e08ddb32d39618a664f460d7f9a32abf888f4d02..461aa0aff3205fa0a0d1b4a11725f1d58ad70af4 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)