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

Make type qualifiers in base class lists a parse error #20866

Open
Bolpat opened this issue Feb 14, 2025 · 0 comments
Open

Make type qualifiers in base class lists a parse error #20866

Bolpat opened this issue Feb 14, 2025 · 0 comments

Comments

@Bolpat
Copy link
Contributor

Bolpat commented Feb 14, 2025

Currently allowed:

class C : const(Object) { }
auto obj = new class const(Object) { };

The const does nothing, it is ignored. It should not compile to write such code.

I’m not suggesting that the following be an error:

alias Base = …; // happens to be const
class C : Base { }
auto obj = new class Base { };

That might break some code (e.g. if the alias is to a typeof) and the fix might be both annoying and non-trivial. However, if const is lexically in the source file, the fix is to simply remove it. In all likelihood, such code does not exist because, again, the qualifier is ignored.

Bolpat pushed a commit to Bolpat/dmd that referenced this issue Feb 14, 2025
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

1 participant