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: nob...@puremagic.com ReportedBy: tcdknut...@gmail.com --- Comment #0 from Dylan Knutson <tcdknut...@gmail.com> 2013-12-24 11:49:03 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: -------