From 76186d20ccf5c5c34f5f4fe2e721738d28890a4a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 11 Apr 2011 18:00:53 -0400 Subject: [PATCH] re PR c++/48535 ([C++0x][SFINAE] Hard errors during list-value-initialization) PR c++/48535 * semantics.c (finish_compound_literal): Handle references. From-SVN: r172286 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/semantics.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6732794f4be..d5975fcfbad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-04-11 Jason Merrill + 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. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index e08ddb32d39..461aa0aff32 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) -- 2.30.2