← Back to index
|
Original Bugzilla link
Bug 2969 – ICE(cod4.c) using const function parameter inside delegate
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2009-05-12T18:32:00Z
Last change time
2015-06-09T01:26:27Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
mikolalysenko
Comments
Comment #0
by mikolalysenko — 2009-05-12T18:32:13Z
Try compiling following snippet: module sound; import std.math; struct Sound { float time; float delegate(float) func; this(float delegate(float) f, float t) { time = t; func = f; } Sound opAdd(const(Sound) other) { return Sound( (float t){ return func(t) + other.func(t); }, fmax(time, other.time)); } Sound opCat(const(Sound) other) { return Sound( (float t){ if(t <= time) return func(t); return other.func(t - time); }, time + other.time); } } Gives the error message: Internal error: ../ztc/cod4.c 353
Comment #1
by gide — 2009-05-13T02:24:57Z
Shorter version. struct Sound { int delegate(int) func; this(int delegate(int) f) { } Sound opAdd(const(Sound) other) { return Sound( (int t){ return other.func(0); }); } }
Comment #2
by clugdbug — 2009-05-13T11:19:45Z
This _might_ be a duplicate of 2560 or 2875.
Comment #3
by clugdbug — 2009-08-05T00:15:43Z
Even shorter test case: struct S { int q; } void foo(const(S) x) { int delegate(int t) bar = (int t){ return 1 + x.q; }; }
Comment #4
by clugdbug — 2009-08-31T02:25:02Z
This is another duplicate of 2560. Worked in 2.022. *** This issue has been marked as a duplicate of issue 2560 ***