[Issue 8312] Too many error messages with a writeln of fixed size array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 25 08:02:45 PDT 2012


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



--- Comment #5 from Kenji Hara <k.hara.pg at gmail.com> 2012-07-25 08:02:42 PDT ---
(In reply to comment #4)
> Probably the errors of the second program too are improved:
> 
> import std.stdio: writeln;
> void main() {
>     immutable int[] A = [1];
>     int[A.length] B;
>     writeln(A);
>     writeln(B);
> }
> 
> but I can't verify the error messages because now it compiles and runs with
> output:
> 
> [1]
> [0]
> 
> So I have added a dependency to Issue 8400. Until Issue 8400 is undone I can't
> verify this Issue 8312 is truly fixed.

No, this is expected behavior. With the declaration `int[A.lehgth] B;`,
A.length is interpreted to integer constant expression 1, then the type of B is
compiled to int[1], it is _static_ array has 1 length, and the B's elements are
initialized with int.init.

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