aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-26 15:28:25 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-26 15:28:25 -0400
commit574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b (patch)
treee83e77854b5490319145c8e64a21bec89b47616f /gcc/cp/decl.c
parent5a87ca71c875b5bc34b9b8bc0ef405cec9b51b51 (diff)
downloadgcc-574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b.zip
gcc-574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b.tar.gz
gcc-574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b.tar.bz2
re PR c++/48530 ([C++0x][SFINAE] Hard errors with deleted d'tors)
PR c++/48530 * decl.c (cxx_maybe_build_cleanup): Add complain parm. * tree.c (force_target_expr): Add complain parm. (build_target_expr_with_type): Likewise. (get_target_expr_sfinae): Split out. (build_vec_init_expr, bot_manip): Adjust. * init.c (build_vec_delete, build_vec_delete_1): Add complain parm. (build_delete, build_dtor_call): Likewise. (perform_direct_initialization_if_possible): Adjust. (build_vec_init): Handle error return. * cvt.c (force_rvalue): Add complain parm. Call build_special_member_call directly. * decl2.c (delete_sanity): Add complain parm. (build_cleanup): Adjust. * pt.c (tsubst_copy_and_build, tsubst_expr): Adjust. * semantics.c (finish_stmt_expr_expr): Adjust. (finish_compound_literal): Adjust. * parser.c (cp_parser_delete_expression): Adjust. * typeck2.c (build_functional_cast): Adjust. * cp-tree.h: Adjust. From-SVN: r172985
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index dcd18ab..ccc5fd0 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5640,7 +5640,7 @@ initialize_local_var (tree decl, tree init)
DECL_READ_P (decl) = 1;
/* Generate a cleanup, if necessary. */
- cleanup = cxx_maybe_build_cleanup (decl);
+ cleanup = cxx_maybe_build_cleanup (decl, tf_warning_or_error);
/* Perform the initialization. */
if (init)
@@ -13309,7 +13309,7 @@ complete_vars (tree type)
cleanup need be done. */
tree
-cxx_maybe_build_cleanup (tree decl)
+cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
{
tree type;
tree attr;
@@ -13344,8 +13344,9 @@ cxx_maybe_build_cleanup (tree decl)
fn = lookup_name (id);
arg = build_address (decl);
mark_used (decl);
- cleanup = cp_build_function_call_nary (fn, tf_warning_or_error,
- arg, NULL_TREE);
+ cleanup = cp_build_function_call_nary (fn, complain, arg, NULL_TREE);
+ if (cleanup == error_mark_node)
+ return error_mark_node;
}
/* Handle ordinary C++ destructors. */
type = TREE_TYPE (decl);
@@ -13367,9 +13368,11 @@ cxx_maybe_build_cleanup (tree decl)
flags |= LOOKUP_NONVIRTUAL;
call = build_delete (TREE_TYPE (addr), addr,
- sfk_complete_destructor, flags, 0);
- if (cleanup)
- cleanup = build_compound_expr (input_location, cleanup, call);
+ sfk_complete_destructor, flags, 0, complain);
+ if (call == error_mark_node)
+ cleanup = error_mark_node;
+ else if (cleanup)
+ cleanup = cp_build_compound_expr (cleanup, call, complain);
else
cleanup = call;
}