Bug 11106 – Chaos on struct with multidimentional static array initialization from its element

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-22T23:16:21Z
Last change time
2024-12-13T18:11:50Z
Keywords
accepts-invalid, rejects-valid
Assigned to
No Owner
Creator
Denis Shelomovskii
Moved to GitHub: dmd#18677 →

Comments

Comment #0 by verylonglogin.reg — 2013-09-22T23:16:21Z
--- struct S { int[2][1] a21; } void main() { int[2][1] a21 = [1, 2]; // ok static assert(!__traits(compiles, a21 = [1])); // ok static assert(!__traits(compiles, { static S ss = { a21: [1]}; })); // assert fails, creates a21 = [[1, 0]] static S ss = { a21: [1, 2]}; // Error: array initializer has 2 elements, but array length is 1 S s = S([1, 2]); // [Issue 11105] Error: cannot implicitly convert expression ([1, 2]) of type int[] to int[2u][1u] } --- Some indices ICEs the compiler: --- struct S { int[2][2] a22; } static S ss = { a22: [1]}; // Assertion failure: 'sz == vsz || sz * dim <= vsz' on line 144 in file 'todt.c' ---
Comment #1 by razvan.nitu1305 — 2023-07-19T11:54:09Z
The ice is no longer present.
Comment #2 by robert.schadek — 2024-12-13T18:11:50Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18677 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB