Skip to content

fix: members re-exported via using reach further derived classes - #1266

Open
gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:fix/members_reexported_via_using_reach_further_derived_classes
Open

fix: members re-exported via using reach further derived classes#1266
gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:fix/members_reexported_via_using_reach_further_derived_classes

Conversation

@gennaroprota

Copy link
Copy Markdown
Collaborator

This fixes a bug for which members re-exported from a base via a using-declaration appeared in the class that exported it, but non in further derived classes. For instance, in:

struct Base { int size() const; };

struct Mid : private Base
{
    using Base::size;
    int count() const;
};

struct Leaf : Mid {};

Mid listed size, while Leaf listed only count.

Changes

  • Source: BaseMemberFinalizer iterates the tranche's member buckets by reflection (rather than from a hand-written list), and suppresses an inherited using-declaration for a given name if that name is also declared normally by the derived class (name hiding).
  • Tests: A new fixture (tests/golden/fixtures/config/inherit-base-members/using-declaration.cpp) is added, covering a chain of derived classes and the name hiding case.
  • Golden tests: No existing golden changes (this means we had no coverage for this bug).

Testing

See above.

Documentation

No change needed. The documentation describes what each inherit-base-members setting does with the members of a base without saying anything specific for using-declarations.

A using-declaration is a member of the class that writes it, so a class
deriving from that one inherits it. The buckets of a record tranche were
inherited from a list written out by hand, and the one holding
using-declarations was missing from the list, so a member re-exported
from a base didn't reach classes further down the hierarchy.

The buckets are discovered by reflection now, so the list cannot fall
behind again.

A using-declaration re-exports a name rather than a signature, so
whatever a derived class declares under that name hides it. This is now
checked in `inheritBaseMembers`.
@github-actions

Copy link
Copy Markdown

✨ Highlights

  • 🧪 New golden tests added

🧾 Changes by Scope

Scope Lines Δ% Lines Δ Lines + Lines - Files Δ Files + Files ~ Files ↔ Files -
🥇 Golden Tests 92% 628 628 - 2 2 - - -
🛠️ Source 8% 54 42 12 2 - 2 - -
Total 100% 682 670 12 4 2 2 - -

Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)

🔝 Top Files

  • tests/golden/fixtures/config/inherit-base-members/using-declaration.xml (Golden Tests): 601 lines Δ (+601 / -0)
  • src/mrdocs/Metadata/Finalizers/BaseMembersFinalizer.cpp (Source): 46 lines Δ (+35 / -11)
  • tests/golden/fixtures/config/inherit-base-members/using-declaration.cpp (Golden Tests): 27 lines Δ (+27 / -0)

Generated by 🚫 dangerJS against 2a8e827

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.12%. Comparing base (e31308f) to head (2a8e827).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1266   +/-   ##
========================================
  Coverage    83.12%   83.12%           
========================================
  Files           35       35           
  Lines         3662     3662           
  Branches       844      844           
========================================
  Hits          3044     3044           
  Misses         410      410           
  Partials       208      208           
Flag Coverage Δ
bootstrap 83.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1266.mrdocs.prtest2.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-08-27 09:13:33 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants