diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2011-11-06 21:05:44 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-11-06 21:05:44 +0000 |
commit | 9965f21f9ce932dd77935cd0375085571e8dffa0 (patch) | |
tree | 078f15895c3fe1af4a24d246903573fc9dfad9d7 /gcc/cp/decl2.c | |
parent | f25481f470c2810f6af2a7fcd76e2a0804b5f738 (diff) | |
download | gcc-9965f21f9ce932dd77935cd0375085571e8dffa0.zip gcc-9965f21f9ce932dd77935cd0375085571e8dffa0.tar.gz gcc-9965f21f9ce932dd77935cd0375085571e8dffa0.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 32b5c7e..f4499b5 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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" |