re PR c++/47695 ([C++0X] Calling a deleted function fails twice)
2011-11-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/47695 * decl2.c (mark_used): Early return false after error or sorry. * cp-tree.h (mark_used): Adjust declaration. * semantics.c (finish_id_expression): Check mark_used return value. From-SVN: r181042
This commit is contained in:
parent
f25481f470
commit
9965f21f9c
|
@ -1,3 +1,10 @@
|
|||
2011-11-06 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/47695
|
||||
* decl2.c (mark_used): Early return false after error or sorry.
|
||||
* cp-tree.h (mark_used): Adjust declaration.
|
||||
* semantics.c (finish_id_expression): Check mark_used return value.
|
||||
|
||||
2011-11-05 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* decl.c (cp_finish_decl): Mostly revert previous change.
|
||||
|
|
|
@ -5049,7 +5049,7 @@ extern tree build_offset_ref_call_from_tree (tree, VEC(tree,gc) **);
|
|||
extern bool decl_constant_var_p (tree);
|
||||
extern bool decl_maybe_constant_var_p (tree);
|
||||
extern void check_default_args (tree);
|
||||
extern void mark_used (tree);
|
||||
extern bool mark_used (tree);
|
||||
extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
|
||||
extern tree cp_build_parm_decl (tree, tree);
|
||||
extern tree get_guard (tree);
|
||||
|
|
|
@ -4203,9 +4203,10 @@ possibly_inlined_p (tree decl)
|
|||
|
||||
/* Mark DECL (either a _DECL or a BASELINK) as "used" in the program.
|
||||
If DECL is a specialization or implicitly declared class member,
|
||||
generate the actual definition. */
|
||||
generate the actual definition. Return false if something goes
|
||||
wrong, true otherwise. */
|
||||
|
||||
void
|
||||
bool
|
||||
mark_used (tree decl)
|
||||
{
|
||||
/* If DECL is a BASELINK for a single function, then treat it just
|
||||
|
@ -4216,7 +4217,7 @@ mark_used (tree decl)
|
|||
{
|
||||
decl = BASELINK_FUNCTIONS (decl);
|
||||
if (really_overloaded_fn (decl))
|
||||
return;
|
||||
return true;
|
||||
decl = OVL_CURRENT (decl);
|
||||
}
|
||||
|
||||
|
@ -4237,13 +4238,13 @@ mark_used (tree decl)
|
|||
generate it properly; see maybe_add_lambda_conv_op. */
|
||||
sorry ("converting lambda which uses %<...%> to "
|
||||
"function pointer");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
error ("use of deleted function %qD", decl);
|
||||
if (!maybe_explain_implicit_delete (decl))
|
||||
error_at (DECL_SOURCE_LOCATION (decl), "declared here");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* We can only check DECL_ODR_USED on variables or functions with
|
||||
|
@ -4252,20 +4253,20 @@ mark_used (tree decl)
|
|||
if ((TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)
|
||||
|| DECL_LANG_SPECIFIC (decl) == NULL
|
||||
|| DECL_THUNK_P (decl))
|
||||
return;
|
||||
return true;
|
||||
|
||||
/* We only want to do this processing once. We don't need to keep trying
|
||||
to instantiate inline templates, because unit-at-a-time will make sure
|
||||
we get them compiled before functions that want to inline them. */
|
||||
if (DECL_ODR_USED (decl))
|
||||
return;
|
||||
return true;
|
||||
|
||||
/* If within finish_function, defer the rest until that function
|
||||
finishes, otherwise it might recurse. */
|
||||
if (defer_mark_used_calls)
|
||||
{
|
||||
VEC_safe_push (tree, gc, deferred_mark_used_calls, decl);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL)
|
||||
|
@ -4294,15 +4295,15 @@ mark_used (tree decl)
|
|||
|
||||
/* If we don't need a value, then we don't need to synthesize DECL. */
|
||||
if (cp_unevaluated_operand != 0)
|
||||
return;
|
||||
return true;
|
||||
|
||||
if (processing_template_decl)
|
||||
return;
|
||||
return true;
|
||||
|
||||
/* Check this too in case we're within fold_non_dependent_expr. */
|
||||
if (DECL_TEMPLATE_INFO (decl)
|
||||
&& uses_template_parms (DECL_TI_ARGS (decl)))
|
||||
return;
|
||||
return true;
|
||||
|
||||
DECL_ODR_USED (decl) = 1;
|
||||
if (DECL_CLONED_FUNCTION_P (decl))
|
||||
|
@ -4380,6 +4381,8 @@ mark_used (tree decl)
|
|||
/*expl_inst_class_mem_p=*/false);
|
||||
--function_depth;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "gt-cp-decl2.h"
|
||||
|
|
|
@ -3286,8 +3286,9 @@ finish_id_expression (tree id_expression,
|
|||
if (TREE_CODE (first_fn) == TEMPLATE_DECL)
|
||||
first_fn = DECL_TEMPLATE_RESULT (first_fn);
|
||||
|
||||
if (!really_overloaded_fn (decl))
|
||||
mark_used (first_fn);
|
||||
if (!really_overloaded_fn (decl)
|
||||
&& !mark_used (first_fn))
|
||||
return error_mark_node;
|
||||
|
||||
if (!template_arg_p
|
||||
&& TREE_CODE (first_fn) == FUNCTION_DECL
|
||||
|
|
Loading…
Reference in New Issue