[Issue 12008] New: alias this and "unable to resolve forward reference" error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 27 01:05:15 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12008

           Summary: alias this and "unable to resolve forward reference"
                    error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2014-01-27 01:05:12 PST ---
Spin-off compiler regression from:
https://d.puremagic.com/issues/show_bug.cgi?id=12000#c1

struct RefCounted(T)
{
    struct RefCountedStore
    {
        private struct Impl    // line 5
        {
            SharedInput _payload;
        }

        private void initialize(A...)(auto ref A args)
        {
            import core.memory;
        }

        void ensureInitialized()
        {
            initialize();
        }

    }
    RefCountedStore _refCounted;

    void opAssign(SharedInput rhs)
    {
    }

    int refCountedPayload()
    {
        _refCounted.ensureInitialized();
        return 0;
    }

    int refCountedPayload() inout;

    alias refCountedPayload this;
}

struct SharedInput
{
    Group unused;
}

struct Group
{
    RefCounted!SharedInput _allGroups;  // line 45
}

void main() {}


Output:
test.d(5): Error: struct
test.RefCounted!(SharedInput).RefCounted.RefCountedStore.Impl unable to resolve
forward reference in definition
test.d(45): Error: template instance test.RefCounted!(SharedInput) error
instantiating

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list