[Issue 15083] declaring a variable, cannot access frame pointer

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 18 08:30:41 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15083

--- Comment #3 from Marc Schütz <schuetzm at gmx.net> ---
(In reply to John Colvin from comment #2)
> You can definitely declare variables with Voldemort types.
> 
> e.g.
> auto foo(){ struct S{} return S(); }
> void bar(){ typeof(foo()) a; }
> 
> is fine.
> 

That's not a "real" Voldemort type with a closure; try this instead:

auto foo(){
    int x;
    struct S {
        int baz() { return x; }
    }
    return S();
}
void bar(){ typeof(foo()) a; } // Error: cannot access frame pointer of
xx.foo.S

> 
> The problem here is to do with the initialiser.
> 
> 	typeof(dirEntries(path, filetype, SpanMode.depth)) files = void;
> 
> doesn't cause any problems.

This could either be an oversight (= bug), or it could be intentional. I
suspect the latter, because it allows to actually declare a Voldemort variable
that is only initialized later.

--


More information about the Digitalmars-d-bugs mailing list