aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-01-10 14:57:54 -0500
committerPatrick Palka <ppalka@redhat.com>2022-01-10 14:57:54 -0500
commitab36b554bd90e8db279d13b133369118814f13fb (patch)
tree6c4abc9617dec954ecde670d2c7be09e5044953a /gcc/ada
parent3e95a974c39e922d19bf7ac1246730c516ae01f2 (diff)
downloadgcc-ab36b554bd90e8db279d13b133369118814f13fb.zip
gcc-ab36b554bd90e8db279d13b133369118814f13fb.tar.gz
gcc-ab36b554bd90e8db279d13b133369118814f13fb.tar.bz2
c++: constexpr base-to-derived conversion with offset 0 [PR103879]
r12-136 made us canonicalize an object/offset pair with negative offset into one with a nonnegative offset, by iteratively absorbing the innermost component into the offset and stopping as soon as the offset becomes nonnegative. This patch strengthens this transformation by making it keep on absorbing even if the offset is already 0 as long as the innermost component is at position 0 (and thus absorbing doesn't change the offset). This lets us accept the two constexpr testcases below, which we'd previously reject essentially because cxx_fold_indirect_ref would be unable to resolve *(B*)&b.D123 (where D123 is the base A subobject at position 0) to just b. PR c++/103879 gcc/cp/ChangeLog: * constexpr.c (cxx_fold_indirect_ref): Split out object/offset canonicalization step into a local lambda. Strengthen it to absorb more components at position 0. Use it before both calls to cxx_fold_indirect_ref_1. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/constexpr-base2.C: New test. * g++.dg/cpp1y/constexpr-base2a.C: New test.
Diffstat (limited to 'gcc/ada')
0 files changed, 0 insertions, 0 deletions