Bug 22638 – [REG 2.096][ICE] cod4.d: Assertion cast(int)sz > 0 failed

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-12-30T19:35:22Z
Last change time
2023-01-01T06:25:05Z
Keywords
backend, C++, ice, ice-on-valid-code, pull
Assigned to
No Owner
Creator
Tim

Comments

Comment #0 by tim.dlang — 2021-12-30T19:35:22Z
extern(C++) struct S { this(ref const(S)); ~this(); } struct AutoRefWrapper(T) if(is(T == class)) { private T obj; template opDispatch(string name) { auto opDispatch(Params...)(auto ref Params params) { return __traits(getMember, obj, name)(params); } } } extern(C++) class C { final void setS(ref const S); final void setS(const S s) { setS(s); } } void main() { C c; AutoRefWrapper!C(c).setS(S()); } Compiling the above code with dmd results in an assertion failure on Linux x86_64: dmd: src/dmd/backend/cod4.d:424: Assertion `cast(int)sz > 0' failed.
Comment #1 by ibuclaw — 2022-01-04T11:45:36Z
ICE started since 2.096.0. Before then program just failed to link.
Comment #2 by ibuclaw — 2022-01-04T12:23:49Z
Comment #3 by bugzilla — 2022-12-21T09:03:45Z
Simplified test case without templates: struct S { this(ref const(S)); ~this(); } struct A { C obj; void disp(S params) { return obj.setS(params); } } extern(C++) struct C { void setS(ref const S); void setS(const S s) { setS(s); } } void main() { A a; a.disp(S()); }
Comment #4 by bugzilla — 2022-12-21T09:13:38Z
Even smaller: struct S { this(ref const(S)); ~this(); } extern(C++) void set(const S s); void disp() { S p; return set(p); }
Comment #5 by dlang-bot — 2022-12-22T03:55:33Z
@WalterBright created dlang/dmd pull request #14732 "fix Issue 22638 - [REG 2.096][ICE] cod4.d: Assertion cast(int)sz > 0 …" fixing this issue: - fix Issue 22638 - [REG 2.096][ICE] cod4.d: Assertion cast(int)sz > 0 failed https://github.com/dlang/dmd/pull/14732
Comment #6 by dlang-bot — 2022-12-22T11:00:53Z
dlang/dmd pull request #14732 "fix Issue 22638 - [REG 2.096][ICE] cod4.d: Assertion cast(int)sz > 0 …" was merged into stable: - f70490871b5796d6d1c42958d58657624c51b5d5 by Walter Bright: fix Issue 22638 - [REG 2.096][ICE] cod4.d: Assertion cast(int)sz > 0 failed https://github.com/dlang/dmd/pull/14732
Comment #7 by dlang-bot — 2023-01-01T06:25:05Z
dlang/dmd pull request #14765 "merge stable" was merged into master: - 89551057e6b247985204a19bceac05ebfe4e685f by Walter Bright: fix Issue 22638 - [REG 2.096][ICE] cod4.d: Assertion cast(int)sz > 0 failed (#14732) https://github.com/dlang/dmd/pull/14765