D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12009 - local import and "unable to resolve forward reference" error
Summary: local import and "unable to resolve forward reference" error
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: pull, rejects-valid
Depends on:
Blocks: 12000
  Show dependency treegraph
 
Reported: 2014-01-27 01:46 UTC by Kenji Hara
Modified: 2015-11-25 16:24 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2014-01-27 01:46:25 UTC
Test case:

struct RefCounted(T)
{
    struct RefCountedStore
    {
        private struct Impl
        {
            T _payload;
        }

        private Impl* _store;
    }
    RefCountedStore _refCounted;

    ~this()
    {
        import core.stdc.stdlib : free;
    }
}

struct GroupBy(R)
{
    struct SharedInput
    {
        Group unused;
    }

    struct Group
    {
        private RefCounted!SharedInput _allGroups;
    }
}

void main()
{
    GroupBy!(int[]) g1;
}

Output:

test.d(5): Error: struct test.RefCounted!(SharedInput).RefCounted.RefCountedStore.Impl unable to resolve forward reference in definition
test.d(29): Error: template instance test.RefCounted!(SharedInput) error instantiating
test.d(35):        instantiated from here: GroupBy!(int[])
test.d(35): Error: template instance test.GroupBy!(int[]) error instantiating
Comment 2 github-bugzilla 2014-04-11 01:46:48 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9681667045165278d3d9bfcabf4f2f4663416b79
fix Issue 12009 - local import and "unable to resolve forward reference" error

`Module::semantic2` could be invoked from local imports, even when some
local symbol semantics are not yet completed.

https://github.com/D-Programming-Language/dmd/commit/915c8806b1c390a6306fad39d80f14602fbe3f09
Merge pull request #3418 from 9rnsr/fix12009

Issue 12009 - local import and "unable to resolve forward reference" error
Comment 3 github-bugzilla 2015-11-25 16:24:02 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bd4447534d132e6ed04db96b9183989ae3f551ad
fix Issue 12009 - local import and "unable to resolve forward reference" error

`Module::semantic2` could be invoked from local imports, even when some
local symbol semantics are not yet completed.