[Issue 11156] New: Refuse wrongly sized array assigned in C-style struct literal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 1 18:35:07 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11156
Summary: Refuse wrongly sized array assigned in C-style struct
literal
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-10-01 18:35:05 PDT ---
struct Foo {
int[3] a;
}
void main() {
Foo f1 = {[10, 20]}; // No error.
Foo f2 = Foo([10, 20]); // Line 6, Error.
}
DMD 2.064 alpha gives:
temp.d(6): Error: cannot implicitly convert expression ([10, 20]) of type int[]
to int[3]
I think D should accept both or refuse both. Probably it should refuse both.
See also issue 481
--
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