D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5104 - Forward reference error with member pure function S.fun(S s)
Summary: Forward reference error with member pure function S.fun(S s)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks: 340
  Show dependency treegraph
 
Reported: 2010-10-23 00:36 UTC by Shin Fujishiro
Modified: 2010-11-08 19:01 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Shin Fujishiro 2010-10-23 00:36:15 UTC
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 Don 2010-11-08 19:01:28 UTC
Fixed DMD2.050