commit 9686efb0957204545ff407b1e4a477da5fc16c4e Author: Jason Merrill Date: Mon Apr 11 12:15:27 2011 -0400 PR c++/48535 * semantics.c (finish_compound_literal): Handle references. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index e08ddb3..461aa0a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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)