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.cdtor] Final overrider used incorrectly #3218

Closed
sdkrystian opened this issue Sep 9, 2019 · 2 comments
Closed

[class.cdtor] Final overrider used incorrectly #3218

sdkrystian opened this issue Sep 9, 2019 · 2 comments

Comments

@sdkrystian
Copy link
Contributor

[class.cdtor] p4 says:

[...] the object (call it x) under construction or destruction, the function called is the final overrider in the constructor's or destructor's class and not one overriding it in a more-derived class.

Final overrider is used as if it refers to a set of functions, which it does not, but rather a singular function. It would be better to say:

the function called is what would be the final overrider of the constructor's or destructor's class if it were the most-derived class.

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Sep 10, 2019
@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Sep 30, 2019
@jensmaurer
Copy link
Member

Editorial teleconference: The wording seems correct as written; whether a function is final overrider depends on which class it is considered a member of.

@sdkrystian
Copy link
Contributor Author

I would argue differently. Consider the following:

struct A
{
  virtual void f();
};

struct B : A
{
  void f(); // overrides A::f, is the final overrider
               // in a most derived object of type B
               // but not in a most derived object of type C
};

struct C : B
{
  void f(); // overrides A::f and B::f
               // is the final overrider 
               // in a most derived object of type C
};

So, when an base class subobject of type B belonging to an object of type C is under construction, B::f() simply isn't a final overrider because C declares a function that overrides f. For any given class type, there is only one final overrider for each virtual function.

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

2 participants