aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-tree.h
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-05-09 16:03:35 -0400
committerJason Merrill <jason@redhat.com>2022-05-10 01:05:51 -0400
commitbb2921ab84dba014f24be06663636c7fb1361474 (patch)
tree4916f6215202be7c12b436d43d04f050ec5f10ef /gcc/cp/cp-tree.h
parent067fe66c8ba9b16feacf66fce9ae668091e42821 (diff)
downloadgcc-bb2921ab84dba014f24be06663636c7fb1361474.zip
gcc-bb2921ab84dba014f24be06663636c7fb1361474.tar.gz
gcc-bb2921ab84dba014f24be06663636c7fb1361474.tar.bz2
c++: fix arm-eabi crash building libstdc++ [PR105529]
My recent change to cxx_eval_store_expression asserts that the target and value can only end up having different types in the case of an empty base; this was crashing arm-eabi compilers because in that ABI [cd]tors return *this, and weren't converting it to void* first. This also shares the 'return this' code between the three places it occurs. Thanks to Marek for the tests. PR c++/105529 gcc/cp/ChangeLog: * decl.cc (maybe_return_this): Replace... (finish_constructor_body, finish_destructor_body): ...these. (finish_function_body): Call it. * optimize.cc (build_delete_destructor_body): Call it. * cp-tree.h (maybe_return_this): Declare. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/constexpr-dtor13.C: New test. * g++.dg/cpp2a/constexpr-dtor14.C: New test.
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r--gcc/cp/cp-tree.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 7e50db0..9fb07d8 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6841,6 +6841,7 @@ extern tree lookup_enumerator (tree, tree);
extern bool start_preparsed_function (tree, tree, int);
extern bool start_function (cp_decl_specifier_seq *,
const cp_declarator *, tree);
+extern void maybe_return_this (void);
extern tree begin_function_body (void);
extern void finish_function_body (tree);
extern tree outer_curly_brace_block (tree);