[Issue 5290] Static array literals with too few elements

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 20 15:08:38 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=5290



--- Comment #10 from bearophile_hugs at eml.cc 2012-01-20 15:08:36 PST ---
(In reply to comment #9)
> (In reply to comment #0)
> > The following invalid code is accepted:
> > import std.stdio;
> > void main() {
> >     real[2] foo = [1.0L];
> >     writeln(foo);  // [1, 0]
> > }
> 
> Running it gives:
> 
> object.Exception at src\rt\arraycat.d(31): lengths don't match for array copy

D is statically typed, so it's better to refuse it at compile-time.

-- 
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