From a46695c1cd0c5ddbb90148538b06005a132b759a Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sat, 11 May 2019 07:50:22 +0000 Subject: [PATCH] typeck.c (cp_build_function_call_vec): When mark_used fails unconditionally return error_mark_node. /cp 2019-05-11 Paolo Carlini * typeck.c (cp_build_function_call_vec): When mark_used fails unconditionally return error_mark_node. /testsuite 2019-05-11 Paolo Carlini * g++.dg/cpp2a/multiple-deleted-destroying-delete-error-1.C: New. * g++.dg/cpp2a/multiple-deleted-destroying-delete-error-2.C: Likewise. From-SVN: r271091 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ .../multiple-deleted-destroying-delete-error-1.C | 12 ++++++++++++ .../multiple-deleted-destroying-delete-error-2.C | 12 ++++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-1.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 33614ef49ec..3da2493f08c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-05-11 Paolo Carlini + + * typeck.c (cp_build_function_call_vec): When mark_used fails + unconditionally return error_mark_node. + 2019-05-10 Paolo Carlini * decl.c (grokvardecl): Use an accurate location in error message diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fff45cc7d80..d1f965be280 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3836,7 +3836,7 @@ cp_build_function_call_vec (tree function, vec **params, return error_mark_node; } - if (!mark_used (function, complain) && !(complain & tf_error)) + if (!mark_used (function, complain)) return error_mark_node; fndecl = function; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a579407439..2efe608a93e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-11 Paolo Carlini + + * g++.dg/cpp2a/multiple-deleted-destroying-delete-error-1.C: New. + * g++.dg/cpp2a/multiple-deleted-destroying-delete-error-2.C: Likewise. + 2019-05-10 Thomas Koenig PR fortran/61968 diff --git a/gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-1.C b/gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-1.C new file mode 100644 index 00000000000..01e41424bc7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-1.C @@ -0,0 +1,12 @@ +// { dg-do compile { target c++2a } } + +#include + +namespace delete_selection_d { + struct B { + void operator delete(void*) = delete; + void operator delete(B *, std::destroying_delete_t) = delete; + }; + void delete_B(B *b) { delete b; } // { dg-bogus "deleted .* deleted" } + // { dg-error "deleted" "" { target c++2a } .-1 } +} diff --git a/gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-2.C b/gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-2.C new file mode 100644 index 00000000000..314e2e9b697 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/multiple-deleted-destroying-delete-error-2.C @@ -0,0 +1,12 @@ +// { dg-do compile { target c++2a } } + +#include + +namespace delete_selection_r { + struct B { + void operator delete(B *, std::destroying_delete_t) = delete; + void operator delete(void*) = delete; + }; + void delete_B(B *b) { delete b; } // { dg-bogus "deleted .* deleted" } + // { dg-error "deleted" "" { target c++2a } .-1 } +} -- 2.30.2