Bug 5104 – Forward reference error with member pure function S.fun(S s)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-10-23T00:36:00Z
Last change time
2010-11-08T19:01:28Z
Keywords
rejects-valid
Assigned to
nobody
Creator
rsinfu
Blocks
340

Comments

Comment #0 by rsinfu — 2010-10-23T00:36:15Z
dmd trunk r727. Forward reference error happens if a member pure function of struct S has a parameter of the type S: -------------------- struct S { bool fun(S s) pure { return true; } } -------------------- % dmd -o- -c test.d test.d(2): Error: struct test.S no size yet for forward reference -------------------- The error happens in TypeStruct::hasPointers() called from TypeFunction::semantic() around line 5011 of mtype.c: -------------------- } } Type *t = fparam->type->toBasetype(); >> if (!t->hasPointers()) continue; if (t->mod & (MODimmutable | MODwild)) continue; --------------------
Comment #1 by clugdbug — 2010-11-08T19:01:28Z
Fixed DMD2.050