| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
September 18, 2015 [Issue 15083] declaring a variable, cannot access frame pointer | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15083 Marc Schütz <schuetzm@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schuetzm@gmx.net --- Comment #1 from Marc Schütz <schuetzm@gmx.net> --- (In reply to John Colvin from comment #0) > This uses phobos, but I'm pretty sure typeof should work here so it's a dmd bug. typeof itself _does_ work, this compiles fine: pragma(msg, typeof(dirEntries(path, filetype, SpanMode.depth))); // prints: FilterResult!(f, DirIterator) But FilteResult is evidently a Voldemort type, and you can't declare a variable of this type. So I believe this is not a bug. -- | ||||
September 18, 2015 [Issue 15083] declaring a variable, cannot access frame pointer | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15083 --- Comment #2 from John Colvin <john.loughran.colvin@gmail.com> --- (In reply to Marc Schütz from comment #1) > (In reply to John Colvin from comment #0) > > This uses phobos, but I'm pretty sure typeof should work here so it's a dmd bug. > > typeof itself _does_ work, this compiles fine: > > pragma(msg, typeof(dirEntries(path, filetype, SpanMode.depth))); > // prints: FilterResult!(f, DirIterator) good point > But FilteResult is evidently a Voldemort type, and you can't declare a variable of this type. So I believe this is not a bug. You can definitely declare variables with Voldemort types. e.g. auto foo(){ struct S{} return S(); } void bar(){ typeof(foo()) a; } is fine. The problem here is to do with the initialiser. typeof(dirEntries(path, filetype, SpanMode.depth)) files = void; doesn't cause any problems. -- | ||||
September 18, 2015 [Issue 15083] declaring a variable, cannot access frame pointer | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15083 --- Comment #3 from Marc Schütz <schuetzm@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. -- | ||||
September 18, 2015 [Issue 15083] declaring a variable, cannot access frame pointer | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15083 --- Comment #4 from John Colvin <john.loughran.colvin@gmail.com> --- (In reply to Marc Schütz from comment #3) > (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 OK, I see what you mean. > > > > 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. Yes, I think it probably is intentional, or at least not a problem that it's allowed. -- | ||||
October 13, 2022 [Issue 15083] declaring a variable, cannot access frame pointer | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15083 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |INVALID --- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> --- According to Marc Schutz's comments this is not a bug. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply