digitalmars.D.learn - Error: variable foo forward referenced
- Nicholas Wilson (39/39) Jul 06 2017 Why does this:
- Nicholas Wilson (1/1) Jul 06 2017 Ignore, I was trying to analyse an uninstantiated template.
Why does this:
enum AddrSpace {
Global,Shared
}
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;
else
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;
}
}
give
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
Ignore, I was trying to analyse an uninstantiated template.
Jul 06 2017








Nicholas Wilson <iamthewilsonator hotmail.com>