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

Disallow enum with indirections #19311

Open
dlangBugzillaToGithub opened this issue Sep 1, 2017 · 0 comments
Open

Disallow enum with indirections #19311

dlangBugzillaToGithub opened this issue Sep 1, 2017 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Bolpat reported this on 2017-09-01T23:29:30Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=17799

Description

It is easily overseen that using enums creates a new instance every time as enums usually have types without indirections or are immutable (e.g. strings).

  enum foo = [1,2,3];

results in

  assert(foo !is foo);

which is weird. Any other identifier that represents an array wouldn't have this oddity.
Make it hard to use incorrectly and disallow enums that have mutable indirections.

See https://forum.dlang.org/post/qgfdcibsepmewijgvaeb@forum.dlang.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant