diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-03-12 10:11:24 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-03-12 10:11:24 +0100 |
commit | 425afe1f0c907e6469cef1672160c9c95177e71a (patch) | |
tree | a35dd0c983e635b77a6b1b09ddfac3ecb1eac044 /gcc/fortran/resolve.c | |
parent | 0df3eb2622d80aed22b2c3814d51e1f455d5e5a1 (diff) | |
download | gcc-425afe1f0c907e6469cef1672160c9c95177e71a.zip gcc-425afe1f0c907e6469cef1672160c9c95177e71a.tar.gz gcc-425afe1f0c907e6469cef1672160c9c95177e71a.tar.bz2 |
c++: Fix up calls to immediate functions returning reference [PR99507]
build_cxx_call calls convert_from_reference at the end, so if an immediate
function returns a reference, we were constant evaluating not just that
call, but that call wrapped in an INDIRECT_REF. That unfortunately means
it can constant evaluate to something non-addressable, so if code later
needs to take its address it will fail.
The following patch fixes that by undoing the convert_from_reference
wrapping for the cxx_constant_value evaluation and readdding it ad the end.
2021-03-12 Jakub Jelinek <jakub@redhat.com>
PR c++/99507
* call.c (build_over_call): For immediate evaluation of functions
that return references, undo convert_from_reference effects before
calling cxx_constant_value and call convert_from_reference
afterwards.
* g++.dg/cpp2a/consteval19.C: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
0 files changed, 0 insertions, 0 deletions