Commit 18101e73 by Jason Merrill Committed by Jason Merrill

PR c++/84447 - ICE with deleted inherited ctor with default arg.

	* call.c (build_over_call): Handle deleted functions in one place.

From-SVN: r258003
parent f18f8ade
2018-02-26 Jason Merrill <jason@redhat.com>
PR c++/84447 - ICE with deleted inherited ctor with default arg.
* call.c (build_over_call): Handle deleted functions in one place.
2018-02-26 Paolo Carlini <paolo.carlini@oracle.com> 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84533 PR c++/84533
......
...@@ -7665,8 +7665,12 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -7665,8 +7665,12 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
deduce_inheriting_ctor (fn); deduce_inheriting_ctor (fn);
/* Make =delete work with SFINAE. */ /* Make =delete work with SFINAE. */
if (DECL_DELETED_FN (fn) && !(complain & tf_error)) if (DECL_DELETED_FN (fn))
return error_mark_node; {
if (complain & tf_error)
mark_used (fn);
return error_mark_node;
}
if (DECL_FUNCTION_MEMBER_P (fn)) if (DECL_FUNCTION_MEMBER_P (fn))
{ {
...@@ -7710,12 +7714,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -7710,12 +7714,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
conversions. */ conversions. */
if (flags & LOOKUP_SPECULATIVE) if (flags & LOOKUP_SPECULATIVE)
{ {
if (DECL_DELETED_FN (fn))
{
if (complain & tf_error)
mark_used (fn);
return error_mark_node;
}
if (cand->viable == 1) if (cand->viable == 1)
return fn; return fn;
else if (!(complain & tf_error)) else if (!(complain & tf_error))
...@@ -8090,7 +8088,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -8090,7 +8088,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
/* [class.copy]: the copy constructor is implicitly defined even if /* [class.copy]: the copy constructor is implicitly defined even if
the implementation elided its use. */ the implementation elided its use. */
if (!trivial || DECL_DELETED_FN (fn)) if (!trivial)
{ {
if (!mark_used (fn, complain) && !(complain & tf_error)) if (!mark_used (fn, complain) && !(complain & tf_error))
return error_mark_node; return error_mark_node;
...@@ -8121,8 +8119,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -8121,8 +8119,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
} }
else if (DECL_ASSIGNMENT_OPERATOR_P (fn) else if (DECL_ASSIGNMENT_OPERATOR_P (fn)
&& DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR) && DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR)
&& trivial_fn_p (fn) && trivial_fn_p (fn))
&& !DECL_DELETED_FN (fn))
{ {
tree to = cp_stabilize_reference tree to = cp_stabilize_reference
(cp_build_fold_indirect_ref (argarray[0])); (cp_build_fold_indirect_ref (argarray[0]));
...@@ -8166,8 +8163,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -8166,8 +8163,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
return val; return val;
} }
else if (!DECL_DELETED_FN (fn) else if (trivial_fn_p (fn))
&& trivial_fn_p (fn))
{ {
if (DECL_DESTRUCTOR_P (fn)) if (DECL_DESTRUCTOR_P (fn))
return fold_convert (void_type_node, argarray[0]); return fold_convert (void_type_node, argarray[0]);
......
// PR c++/84447
// { dg-do compile { target c++11 } }
struct A
{
template<typename T> A(T, T = 0) = delete;
};
struct B : A
{
using A::A; // { dg-error "deleted" }
};
B b(0); // { dg-error "deleted" }
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