www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Error: variable foo forward referenced

reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
Why does this:

enum AddrSpace {

struct Pointer(AddrSpace as, T)
     T* ptr;
     alias ptr this;
struct AutoIndexed(T) if (is(T : Pointer!(n,U),AddrSpace n,U))
     T p;

     private  property auto idx()
         static if (n == AddrSpace.Global)
             return GlobalIndex.linear;
         else static if (n == AddrSpace.Shared)
             return SharedIndex.linear;
             static assert(0, "can only auto index a GlobalPointer 
or SharedPointer");

      property U index()
         return p[idx];

      property void index(U t)
         p[idx] = t;


Error: variable p forward referenced

halfway though MY semantic pass????

I've tried
is(T == Pointer!(n,U),AddrSpace n,U)
is(T : Pointer!(n,U), n,U)
and a bunch of other combos.
Why am I getting this and how do I get rid of it?
Jul 06 2017
parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
Ignore, I was trying to analyse an uninstantiated template.
Jul 06 2017