diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-01-08 10:11:25 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-01-08 10:11:25 -0500 |
commit | bb1f0b50abbfa01e0ed720a5225a11aa7af32a89 (patch) | |
tree | 886628713cacc3c072c090e3b42db7a5f5e5f10d /gcc/function.c | |
parent | 98a1fb705ead9258642f2dec0431f11508a9b13c (diff) | |
download | gcc-bb1f0b50abbfa01e0ed720a5225a11aa7af32a89.zip gcc-bb1f0b50abbfa01e0ed720a5225a11aa7af32a89.tar.gz gcc-bb1f0b50abbfa01e0ed720a5225a11aa7af32a89.tar.bz2 |
c++: ICE with constexpr call that returns a PMF [PR98551]
We shouldn't do replace_result_decl after evaluating a call that returns
a PMF because PMF temporaries aren't wrapped in a TARGET_EXPR (and so we
can't trust ctx->object), and PMF initializers can't be self-referential
anyway, so replace_result_decl would always be a no-op.
To that end, this patch changes the relevant AGGREGATE_TYPE_P test to
CLASS_TYPE_P, which should rule out PMFs (as well as arrays, which we
can't return and therefore won't see here). This fixes an ICE from the
sanity check in replace_result_decl in the below testcase during
constexpr evaluation of the call f() in the initializer g(f()).
gcc/cp/ChangeLog:
PR c++/98551
* constexpr.c (cxx_eval_call_expression): Check CLASS_TYPE_P
instead of AGGREGATE_TYPE_P before calling replace_result_decl.
gcc/testsuite/ChangeLog:
PR c++/98551
* g++.dg/cpp0x/constexpr-pmf2.C: New test.
Diffstat (limited to 'gcc/function.c')
0 files changed, 0 insertions, 0 deletions