digitalmars.D.bugs - [Issue 11812] New: Associative array .keys needs 'this' at compile time
- d-bugmail puremagic.com (43/43) Dec 24 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11812
https://d.puremagic.com/issues/show_bug.cgi?id=11812 Summary: Associative array .keys needs 'this' at compile time Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: tcdknutson gmail.com PST --- DMD compiler 2.064, Windows 7 64 bit ``` enum myaa = ["foo": "bar"]; template MyTemplate(alias Arr) { enum MyTemplate = Arr.length; } void main() { // Fails auto a = MyTemplate!(myaa.keys); } version(none): void main() { // Works enum keys = myaa.keys; auto a = MyTemplate!keys; } ``` Passing an AA's .keys to a template directly fails, but making `keys` a separate enum allows them to be passed. Error: aabug.d(5): Error: need 'this' for 'keys' of type 'pure nothrow property system string[]()' aabug.d(10): Error: template instance aabug.MyTemplate!(keys) error instantiating -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 24 2013