[Issue 12000] Forward reference issue with RefCounted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 25 20:48:49 PST 2014


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> 2014-01-25 20:48:39 PST ---
Eliminating the dependency on Phobos:
--------------------------------------------
struct RefCounted(T)
{
    struct RefCountedStore
    {
        private struct Impl
        {
            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;
}
------------------------------------------------
foo.d(6): Error: struct
foo.RefCounted!(SharedInput).RefCounted.RefCountedStore.Impl unable to resol
ve forward reference in definition
foo.d(46): Error: template instance foo.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