cfn_ffs overrides the irange overload of fold_range, which hides
range_operator's declaration of that overload in cfn_ffs. The
using-declaration "using range_operator::fold_range" in cfn_popcount,
whose only direct base is cfn_ffs, therefore names a member that is
not visible in any direct base.
The published C++14, C++17 and C++20 wording of [namespace.udecl]/17
required members named by a using-declaration to be visible in the
scope of at least one direct base class. P1787R6, adopted for C++23,
removed this restriction.
GCC and Clang accept the existing declaration, but EDG-based compilers
enforcing the earlier wording reject it in pre-C++23 modes.
Name cfn_ffs instead. cfn_ffs itself has
"using range_operator::fold_range", so the overload set and range
folding behaviour are unchanged.
Bootstrapped and regression-tested on aarch64-unknown-linux-gnu
(C and C++) and x86_64-pc-linux-gnu (default languages). No new
regressions.
gcc/ChangeLog:
* gimple-range-op.cc (class cfn_popcount): Name the direct
base cfn_ffs instead of range_operator in the using-declaration
for fold_range.
Signed-off-by: Shiva <[email protected]>
---
v1: https://gcc.gnu.org/pipermail/gcc-patches/2026-November/738330.html
Changes since v1:
- Explain why the hidden fold_range overload matters.
- Clarify the C++14, C++17 and C++20 wording and P1787R6.
- Note that EDG-based compilers reject the existing declaration in
pre-C++23 modes.
- Document the additional x86_64 bootstrap and regression testing.
gcc/gimple-range-op.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/gimple-range-op.cc b/gcc/gimple-range-op.cc
index 20666ff0356..49196f752b2 100644
--- a/gcc/gimple-range-op.cc
+++ b/gcc/gimple-range-op.cc
@@ -946,7 +946,7 @@ public:
class cfn_popcount : public cfn_ffs
{
public:
- using range_operator::fold_range;
+ using cfn_ffs::fold_range;
virtual bool fold_range (irange &r, tree type, const irange &lh,
const irange &rh, relation_trio rel) const
{