Commit b8aaa1a3 by Jason Merrill Committed by Jason Merrill

decl.c (cxx_maybe_build_cleanup): Always set LOOKUP_NONVIRTUAL.

	* decl.c (cxx_maybe_build_cleanup): Always set LOOKUP_NONVIRTUAL.
	* decl2.c (build_cleanup): Just call cxx_maybe_build_cleanup.

From-SVN: r204265
parent 1c79ebd5
2013-10-31 Jason Merrill <jason@redhat.com> 2013-10-31 Jason Merrill <jason@redhat.com>
* decl.c (cxx_maybe_build_cleanup): Always set LOOKUP_NONVIRTUAL.
* decl2.c (build_cleanup): Just call cxx_maybe_build_cleanup.
PR c++/58162 PR c++/58162
* parser.c (cp_parser_late_parse_one_default_arg): Set * parser.c (cp_parser_late_parse_one_default_arg): Set
TARGET_EXPR_DIRECT_INIT_P. TARGET_EXPR_DIRECT_INIT_P.
......
...@@ -14298,9 +14298,7 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) ...@@ -14298,9 +14298,7 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
type = TREE_TYPE (decl); type = TREE_TYPE (decl);
if (type_build_dtor_call (type)) if (type_build_dtor_call (type))
{ {
int flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR; int flags = LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR;
bool has_vbases = (TREE_CODE (type) == RECORD_TYPE
&& CLASSTYPE_VBASECLASSES (type));
tree addr; tree addr;
tree call; tree call;
...@@ -14309,10 +14307,6 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) ...@@ -14309,10 +14307,6 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
else else
addr = build_address (decl); addr = build_address (decl);
/* Optimize for space over speed here. */
if (!has_vbases || flag_expensive_optimizations)
flags |= LOOKUP_NONVIRTUAL;
call = build_delete (TREE_TYPE (addr), addr, call = build_delete (TREE_TYPE (addr), addr,
sfk_complete_destructor, flags, 0, complain); sfk_complete_destructor, flags, 0, complain);
if (call == error_mark_node) if (call == error_mark_node)
......
...@@ -2722,26 +2722,9 @@ import_export_decl (tree decl) ...@@ -2722,26 +2722,9 @@ import_export_decl (tree decl)
tree tree
build_cleanup (tree decl) build_cleanup (tree decl)
{ {
tree temp; tree clean = cxx_maybe_build_cleanup (decl, tf_warning_or_error);
tree type = TREE_TYPE (decl); gcc_assert (clean != NULL_TREE);
return clean;
/* This function should only be called for declarations that really
require cleanups. */
gcc_assert (!TYPE_HAS_TRIVIAL_DESTRUCTOR (type));
/* Treat all objects with destructors as used; the destructor may do
something substantive. */
mark_used (decl);
if (TREE_CODE (type) == ARRAY_TYPE)
temp = decl;
else
temp = build_address (decl);
temp = build_delete (TREE_TYPE (temp), temp,
sfk_complete_destructor,
LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0,
tf_warning_or_error);
return temp;
} }
/* Returns the initialization guard variable for the variable DECL, /* Returns the initialization guard variable for the variable DECL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment