digitalmars.D.bugs - [Issue 2351] New: enum with no members allowed
- d-bugmail puremagic.com (17/17) Sep 10 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2351
- d-bugmail puremagic.com (10/10) Oct 25 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2351
- d-bugmail puremagic.com (15/15) Feb 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2351
- d-bugmail puremagic.com (7/7) Feb 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2351
- d-bugmail puremagic.com (11/13) Feb 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2351
- d-bugmail puremagic.com (18/18) Feb 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2351
- d-bugmail puremagic.com (9/9) Jan 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2351
- d-bugmail puremagic.com (10/10) Jan 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2351
http://d.puremagic.com/issues/show_bug.cgi?id=2351
Summary: enum with no members allowed
Product: D
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: tomas famolsen.dk
The spec grammar allows EnumBody to be just a semicolon, however a little
further down it also says that enums must have at least one member.
This compiles however:
enum a;
--
Sep 10 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2351
smjg iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg iname.com
Keywords| |spec
Either this is a contradiction in the spec, or we need clarification of what
';' as an EnumBody means.
--
Oct 25 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2351
Jerry Quinn <jlquinn optonline.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://digitalmars.com/d/2.
| |0/enum.html
CC| |jlquinn optonline.net
---
This would be fixed by changing the EnumBody rule to
EnumBody:
EnumMember ;
{ EnumMembers }
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2351 So the meaning of that code changes from declaring an enum type with no members to declaring a manifest constant with value 0. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2351 ---So the meaning of that code changes from declaring an enum type with no members to declaring a manifest constant with value 0.That seems more reasonable to me. However, if you specify a type as well, DMD rejects it: enum long a; enum1.d(1): Error: variable enum1.a manifest constants must have initializers So at the moment it is inconsistent. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2351
---
I think the semicolon is intended to handle manifest constants. However, it
doesn't look quite right.
If the grammar is rewritten as follows:
EnumDeclaration:
enum EnumBody
enum EnumTag EnumBody
enum : EnumBaseType EnumBody
enum EnumTag : EnumBaseType EnumBody
enum EnumMember ;
EnumBody:
{ EnumMembers }
Then manifest constants will be handled by the grammar, although the compiler
enforces that they need an initializer.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2351 Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org https://github.com/D-Programming-Language/d-programming-language.org/commit/31be563dc0bc4afaaf84c24deb527d60c3ec2e83 fix Issue 2351 - enum with no members allowed -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2351
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla digitalmars.com
Resolution| |FIXED
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 22 2012









d-bugmail puremagic.com 