[Issue 6617] Two problems using enum lenghs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 2 10:33:00 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6617


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #3 from bearophile_hugs at eml.cc 2012-12-02 10:32:59 PST ---
(In reply to comment #2)
> (In reply to comment #0)
> > This is a bug report. I have found two different problems while creating a
> > fixed-sized array as long as the number members of an enum (DMD 2.055beta3)
> 
> All of these now work.

Right, I close this bug report. Issue 4997 covers the enhancement request.


> The problem with this is that lookups also go to the base type of the enum, so:
> 
> struct T
> {
>     @property static size_t length() { return 0; }
> }
> 
> enum Foo : T { a = T() }
> 
> void main()
> {
>     assert(Foo.length == 1);  // fails
> }

Enums already have some built-in attributes, that cause some troubles. In 
Issue 4997 I have suggested a namespace named "meta", so you write
"MyEnum.meta.length". But then a problem is that MyEnum.meta.max breaks the
convention that D integral types have a "max" attribute.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list