digitalmars.D.bugs - [Issue 5437] New: Problems with length of std.traits.EnumMembers
- d-bugmail puremagic.com (42/42) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5437
- d-bugmail puremagic.com (15/15) Apr 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5437
- d-bugmail puremagic.com (11/11) Apr 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5437
- d-bugmail puremagic.com (10/10) Apr 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5437
http://d.puremagic.com/issues/show_bug.cgi?id=5437
Summary: Problems with length of std.traits.EnumMembers
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
A D2 program:
import std.traits: EnumMembers;
enum Foo { A, B }
void main() {
alias EnumMembers!Foo members; // OK
enum n1 = members.length; // OK
enum n2 = (EnumMembers!Foo).length; // line 6, Error
}
DMD 2.051 shows the error:
test.d(6): Error: EnumMembers!(Foo) is used as a type
------------------------
A similar program:
import std.traits: EnumMembers;
enum Foo { A, B }
void main() {
alias EnumMembers!Foo members;
enum n = members.length; // OK
int[n] data1; // OK
int[members.length] data2; // line 7, ERROR
}
DMD 2.051 shows the errors:
test.d(7): Error: identifier 'length' of 'members.length' is not defined
test.d(7): Error: index is not a type or an expression
I have add a "DMD" tag for the Component of this bug because I am not sure
about the cause.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5437
SomeDude <lovelydear mailmetrash.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lovelydear mailmetrash.com
PDT ---
For the first one, I think you can't ask for the length of members of the
struct before it has finished instantiating templates. So I don't find the
first one surprising.
The compiler tells you that a template that has not been instantiated is not a
type.
The second one compiles fine on 2.059.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5437 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b378fb830983025d65582b2a57fc92f2d432ae87 fix Issue 5437 - Problems with length of std.traits.EnumMembers https://github.com/D-Programming-Language/dmd/commit/8a0d1309b7fb7d3e793735762901f8a9c99cd4f8 Issue 5437 - Problems with length of std.traits.EnumMembers -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5437
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: -------
Apr 23 2012









d-bugmail puremagic.com 