[Issue 7227] New: [] syntax for empty associative array too?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 4 14:37:29 PST 2012
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: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at 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: -------
More information about the Digitalmars-d-bugs
mailing list