aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.cc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-05-01 21:03:45 -0400
committerJason Merrill <jason@redhat.com>2023-05-02 16:24:20 -0400
commita43f3616c0069541b1f465eea67285eeeff36785 (patch)
tree0163b56e55840e3f3ebd74706dcbfc653c024f30 /gcc/cp/constexpr.cc
parent4b8d0d4d7fd245ef85c7801e7838845502a5a61d (diff)
downloadgcc-a43f3616c0069541b1f465eea67285eeeff36785.zip
gcc-a43f3616c0069541b1f465eea67285eeeff36785.tar.gz
gcc-a43f3616c0069541b1f465eea67285eeeff36785.tar.bz2
c++: look for empty base at specific offset [PR109678]
While looking at the empty base handling for 109678, it occurred to me that we ought to be able to look for an empty base at a specific offset, not just in general. PR c++/109678 gcc/cp/ChangeLog: * cp-tree.h (lookup_base): Add offset parm. * constexpr.cc (cxx_fold_indirect_ref_1): Pass it. * search.cc (struct lookup_base_data_s): Add offset. (dfs_lookup_base): Handle it. (lookup_base): Pass it.
Diffstat (limited to 'gcc/cp/constexpr.cc')
-rw-r--r--gcc/cp/constexpr.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 37d1c44..70dd6cf 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -5452,7 +5452,7 @@ cxx_fold_indirect_ref_1 (const constexpr_ctx *ctx, location_t loc, tree type,
which is likely to be a waste of time (109678). */
if (is_empty_class (type)
&& CLASS_TYPE_P (optype)
- && DERIVED_FROM_P (type, optype))
+ && lookup_base (optype, type, ba_any, NULL, tf_none, off))
{
if (empty_base)
*empty_base = true;