Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[class.member.lookup] lookups names in base class *subobjects* #3519

Open
languagelawyer opened this issue Nov 27, 2019 · 4 comments
Open

[class.member.lookup] lookups names in base class *subobjects* #3519

languagelawyer opened this issue Nov 27, 2019 · 4 comments

Comments

@languagelawyer
Copy link
Contributor

I think subobjects do not contain names, but base classes do.

[class.virtual]/2 also says "(base) class (sub)object" when it should say "(base) class":

A virtual member function C::vf of a class object S is a final overrider unless the most derived class (6.7.2) of which S is a base class subobject (if any) declares or inherits another member function that overrides vf. In a derived class, if a virtual member function of a base class subobject has more than one final overrider the program is ill-formed.

I believe such fix would be consistent with the wording in [class.derived]:

A class B is a base class of a class D if it is a direct base class of D or a direct base class of one of D’s base classes.

@opensdh
Copy link
Contributor

opensdh commented Apr 27, 2020

What we mean here is neither "an object" (something that exists at runtime) nor "a class" (a type), but rather "an inheritance":

struct A {};
struct B : A {};
struct C : A {};
struct D : B,C {};
int main() {return 0;}

In this program there are 0 A objects, 1 A class, and 4 A inheritances (2 of them direct).

@languagelawyer
Copy link
Contributor Author

So the proper fix here would be to introduce the whole new term/concept into the standard?

@opensdh
Copy link
Contributor

opensdh commented Apr 27, 2020

That, or else explicitly state that "base class subobject" has a meaning as a component of a class as well as as a component of an object. This isn't entirely unreasonable: after all, a complete object of type X has exactly one of the object-kind for each of the class-kind that X itself has, and it parallels "class member"/"member subobject".

@jensmaurer
Copy link
Member

This got reworded by P1787R6, applied by commit c7e8927
This issue seems to be still open, though.

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

No branches or pull requests

3 participants