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

are abstract / base specifiers permitted or required on class forward declarations? #3384

Open
zygoloid opened this issue Nov 10, 2023 · 2 comments
Labels
leads question A question for the leads team

Comments

@zygoloid
Copy link
Contributor

zygoloid commented Nov 10, 2023

Summary of issue:

Given this class:

base class C {}

how does one write a forward declaration? Is

base class C;

valid? Is

class C;

valid?

Details:

There doesn't seem to be a reason to require the abstract or base specifier to be present on a forward declaration. But usually our forward declaration syntax for classes is a prefix of the definition, and there also doesn't seem to be any particular hardship to developers in requiring the forward declaration to repeat the specifier.

In addition to the three answers suggested by the question (specifier is disallowed, specifier is allowed but not required, specifier is required), we could change the class definition syntax to put the specifier in the class body, as we did for inheritance:

class C {
  base class;
  extend base: B;
}

Any other information that you want to share?

No response

@zygoloid zygoloid added the leads question A question for the leads team label Nov 10, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 13, 2023
)

For now, we require the same introducer to be used each time a class is
declared, but see #3384.

---------

Co-authored-by: Jon Ross-Perkins <[email protected]>
@justzh

This comment was marked as off-topic.

@chandlerc
Copy link
Contributor

@justzh - Please keep comments on PRs and issues constructive and on-topic. I'm hiding yours, but you've had warnings now and so I will block if this continues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leads question A question for the leads team
Projects
None yet
Development

No branches or pull requests

3 participants