[C++ PATCH 82560] missing dtor call
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01068.html PR c++/82560 * call.c (build_over_call): Don't pass tf_no_cleanup to nested calls. PR c++/82560 * g++.dg/cpp0x/pr82560.C: New. From-SVN: r253822
This commit is contained in:
parent
0c2ff9c396
commit
a203c78308
@ -1,3 +1,9 @@
|
|||||||
|
2017-10-17 Nathan Sidwell <nathan@acm.org>
|
||||||
|
|
||||||
|
PR c++/82560
|
||||||
|
* call.c (build_over_call): Don't pass tf_no_cleanup to nested
|
||||||
|
calls.
|
||||||
|
|
||||||
2017-10-06 Jakub Jelinek <jakub@redhat.com>
|
2017-10-06 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR c++/82299
|
PR c++/82299
|
||||||
|
@ -7668,8 +7668,11 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* N3276 magic doesn't apply to nested calls. */
|
/* N3276 magic doesn't apply to nested calls. */
|
||||||
int decltype_flag = (complain & tf_decltype);
|
tsubst_flags_t decltype_flag = (complain & tf_decltype);
|
||||||
complain &= ~tf_decltype;
|
complain &= ~tf_decltype;
|
||||||
|
/* No-Cleanup doesn't apply to nested calls either. */
|
||||||
|
tsubst_flags_t no_cleanup_complain = complain;
|
||||||
|
complain &= ~tf_no_cleanup;
|
||||||
|
|
||||||
/* Find maximum size of vector to hold converted arguments. */
|
/* Find maximum size of vector to hold converted arguments. */
|
||||||
parmlen = list_length (parm);
|
parmlen = list_length (parm);
|
||||||
@ -7851,7 +7854,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
|
|||||||
if (flags & LOOKUP_NO_CONVERSION)
|
if (flags & LOOKUP_NO_CONVERSION)
|
||||||
conv->user_conv_p = true;
|
conv->user_conv_p = true;
|
||||||
|
|
||||||
tsubst_flags_t arg_complain = complain & (~tf_no_cleanup);
|
tsubst_flags_t arg_complain = complain;
|
||||||
if (!conversion_warning)
|
if (!conversion_warning)
|
||||||
arg_complain &= ~tf_warning;
|
arg_complain &= ~tf_warning;
|
||||||
|
|
||||||
@ -8096,7 +8099,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
|
|||||||
else if (default_ctor_p (fn))
|
else if (default_ctor_p (fn))
|
||||||
{
|
{
|
||||||
if (is_dummy_object (argarray[0]))
|
if (is_dummy_object (argarray[0]))
|
||||||
return force_target_expr (DECL_CONTEXT (fn), void_node, complain);
|
return force_target_expr (DECL_CONTEXT (fn), void_node,
|
||||||
|
no_cleanup_complain);
|
||||||
else
|
else
|
||||||
return cp_build_indirect_ref (argarray[0], RO_NULL, complain);
|
return cp_build_indirect_ref (argarray[0], RO_NULL, complain);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2017-10-17 Nathan Sidwell <nathan@acm.org>
|
||||||
|
|
||||||
|
PR c++/82560
|
||||||
|
* g++.dg/cpp0x/pr82560.C: New.
|
||||||
|
|
||||||
2017-10-17 Jakub Jelinek <jakub@redhat.com>
|
2017-10-17 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR tree-optimization/82549
|
PR tree-optimization/82549
|
||||||
|
28
gcc/testsuite/g++.dg/cpp0x/pr82560.C
Normal file
28
gcc/testsuite/g++.dg/cpp0x/pr82560.C
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// { dg-do run { target c++11 } }
|
||||||
|
// PR82560, failed to destruct default arg inside new
|
||||||
|
|
||||||
|
static int liveness = 0;
|
||||||
|
|
||||||
|
struct Foo {
|
||||||
|
|
||||||
|
Foo (int) {
|
||||||
|
liveness++;
|
||||||
|
}
|
||||||
|
|
||||||
|
~Foo() {
|
||||||
|
liveness--;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Bar {
|
||||||
|
Bar (Foo = 0) { }
|
||||||
|
~Bar() { }
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
delete new Bar();
|
||||||
|
|
||||||
|
return liveness != 0;;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user