http://d.puremagic.com/issues/show_bug.cgi?id=7227
Summary: [] syntax for empty associative array too? Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: minor Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2012-01-04 14:37:27 PST --- void foo(int[int] bb) {} void main() { int[int] aa; aa = null; // OK foo(null); // OK aa = []; // Error foo([]); // Error } DMD 2.058head gives: test.d(6): Error: cannot implicitly convert expression ([]) of type void[] to int[int] test.d(7): Error: function test2.foo (int[int] bb) is not callable using argument types (void[]) test.d(7): Error: cannot implicitly convert expression ([]) of type void[] to int[int] I am not sure, but maybe the second syntax too should be accepted. An alternative syntax for empty associative array literal: void foo(int[int] bb) {} void main() { int[int] aa; aa = [:]; foo([:]); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------