Skip to content

Does Base_subobject also needs access specifier? #267

Description

@GorNishanov

Consider:

struct A {};
struct B {};

struct C : protected B, private A {};

Prior to introduction of subobjects, base_type was a declaration that had DeclSpecifiers that could encode both AccessProtection and virtual-ness of the base:

   enum class DeclSpecifiers : std::uint32_t {
       ...
      Virtual    = 1 << 6,   // also used as storage class specifier
                             // for virtual base subobjects
       ...
      Public     = 1 << 11,
      Protected  = 1 << 12,
      Private    = 1 << 13,
      AccessProtection = Public | Protected | Private,
       ...
   };

Looking at current definition of Base_subobject:

   // Specifier of semantics for base-class subobjects.
   enum class Subobject_specifier : std::uint8_t {
      Exclusive,                    // Each subobject is unshared, default in ISO C++
      Shared,                       // "virtual" subobject shared along inheritance chain
   };

                                // -- Base_subobject --
   // Each base-specifier in a base-clause morally declares an unnamed subobject.
   struct Base_subobject {
      virtual const Type& type() const = 0;
      virtual Subobject_specifier specifier() const = 0;
   };

it seems that we may have lost an ability to encode access protection for bases

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions