aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-11 18:00:42 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-11 18:00:42 -0400
commit834aa42659a1408370b8dc323a3ccd2334ce5e16 (patch)
treebb2e4729240d155e6ce8e883d088bbe7e83df94e /gcc/cp/semantics.c
parent55b13820b4be09c8b8bceaad41d5b5af2c73b411 (diff)
downloadgcc-834aa42659a1408370b8dc323a3ccd2334ce5e16.zip
gcc-834aa42659a1408370b8dc323a3ccd2334ce5e16.tar.gz
gcc-834aa42659a1408370b8dc323a3ccd2334ce5e16.tar.bz2
re PR c++/48535 ([C++0x][SFINAE] Hard errors during list-value-initialization)
PR c++/48535 * semantics.c (finish_compound_literal): Take complain parm. (build_lambda_object): Adjust. * cp-tree.h: Adjust. * call.c (convert_like_real): Adjust. * decl.c (check_initializer): Adjust. * parser.c (cp_parser_postfix_expression): Adjust. (cp_parser_functional_cast): Adjust. * pt.c (tsubst_copy_and_build): Adjust. * typeck2.c (process_init_constructor_record): Adjust. From-SVN: r172285
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 0b4d1ec..e08ddb3 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2309,14 +2309,16 @@ finish_unary_op_expr (enum tree_code code, tree expr)
the CONSTRUCTOR in COMPOUND_LITERAL is being cast. */
tree
-finish_compound_literal (tree type, tree compound_literal)
+finish_compound_literal (tree type, tree compound_literal,
+ tsubst_flags_t complain)
{
if (type == error_mark_node)
return error_mark_node;
if (!TYPE_OBJ_P (type))
{
- error ("compound literal of non-object type %qT", type);
+ if (complain & tf_error)
+ error ("compound literal of non-object type %qT", type);
return error_mark_node;
}
@@ -2338,7 +2340,7 @@ finish_compound_literal (tree type, tree compound_literal)
that it came from T{} rather than T({}). */
CONSTRUCTOR_IS_DIRECT_INIT (compound_literal) = 1;
compound_literal = build_tree_list (NULL_TREE, compound_literal);
- return build_functional_cast (type, compound_literal, tf_error);
+ return build_functional_cast (type, compound_literal, complain);
}
if (TREE_CODE (type) == ARRAY_TYPE
@@ -7928,7 +7930,7 @@ build_lambda_object (tree lambda_expr)
But we briefly treat it as an aggregate to make this simpler. */
type = TREE_TYPE (lambda_expr);
CLASSTYPE_NON_AGGREGATE (type) = 0;
- expr = finish_compound_literal (type, expr);
+ expr = finish_compound_literal (type, expr, tf_warning_or_error);
CLASSTYPE_NON_AGGREGATE (type) = 1;
out: