Skip to content

[cxx-interop] Finalize Swift 5.9 rules that determine when inherited members that shadow other members can be introduced to the Swift type that represents the C++ structure or class  #66323

@hyp

Description

@hyp

The exact rules that determine when members from inherited base types are introduced to Swift’s representation of the C++ type are not yet finalized in Swift 5.9. This issue tracks their finalization.

The current rules need to be updated to handle shadowing better. For example, given the following C++ code:

class Plant {
public:
  void water(float amount) { moisture += amount; }
private:
  float moisture = 0.0;
};

class Fern: public Plant {
public:
  void trim();
  void water(float amount);
};

A user in Swift won't be unable to call the water method on a Fern object, as Swift will think it's an ambiguous call.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++c++ to swiftFeature → c++ interop: c++ to swiftcompilerThe Swift compiler itselfswift 5.9

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions