Bug 12879 – Wrong line number for run-time array cast misalignment error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-06-08T17:00:01Z
Last change time
2022-05-25T20:45:03Z
Keywords
diagnostic
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-06-08T17:00:01Z
void main() { void[] v = new void[40]; ubyte[7][] b = cast(ubyte[7][])v; } DMD 2.066alpha gives: object.Error@(0): array cast misalignment While I expected something more like: object.Error@(3): array cast misalignment
Comment #1 by ben.james.jones — 2022-05-25T18:10:16Z
Results on dmd 2.099.1 core.exception.AssertError@/dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/array/casting.d(62): An array of size 40 does not align on an array of size 35, so `void` cannot be cast to `ubyte[7]` ---------------- ??:? _d_assert_msg [0x5576b5122940] /dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/array/casting.d:62 pure nothrow @nogc @trusted void core.internal.array.casting.onArrayCastError!().onArrayCastError(immutable(char)[], ulong, immutable(char)[], ulong) [0x5576b511a283] /dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/array/casting.d:82 pure nothrow @nogc @trusted ubyte[7][] core.internal.array.casting.__ArrayCast!(void, ubyte[7]).__ArrayCast(return scope void[]) [0x5576b511a112] ./onlineapp.d:3 _Dmain [0x5576b511a077] This looks like a descriptive and accurate error, so I think this should be closed. Is there an easy way to find out which version fixed this? Do we care?
Comment #2 by maxhaton — 2022-05-25T20:39:01Z
You can try the all compilers option on run.dlang.io It's not a priority though.
Comment #3 by ben.james.jones — 2022-05-25T20:45:03Z
Looks like the current error message (or close enough) was added in 2.086.1