Bug 13860 – template required forward reference for typeof(member)

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-14T08:42:00Z
Last change time
2015-06-17T21:03:34Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
vlevenfeld

Comments

Comment #0 by vlevenfeld — 2014-12-14T08:42:45Z
struct Foo (Bar...) { Bar bars; auto baz (size_t d)(){} pragma(msg, typeof(baz!0)); // line A } auto bar (S,R)(S, R) {pragma(msg, typeof(Foo!().baz!0));} // line B void main () {/*...}*/ int[] x; int[] y; x.bar (y); } if line A is not commented out: Error: Foo!().Foo no size yet for forward reference line B displays the expected output.
Comment #1 by k.hara.pg — 2015-01-20T03:20:09Z
Comment #2 by github-bugzilla — 2015-01-20T13:08:29Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3a5c42c44da72d4a2afbc6029e7b68da87946955 fix Issue 13860 - template required forward reference for typeof(member) In a struct member function S.foo, 'this' is declared as a ref variable by `declareThis()` in `FuncDeclaration::semantic3()`. But in `VarDeclaration::semantic`, `type->hasPointer()` will needlessly try to resolve struct fwdref. All parameter variables won't be declared with void initializer, so the reordering fixes the issue. https://github.com/D-Programming-Language/dmd/commit/661f23ddde5d759fd5367f45f89803b79ab8e32c Merge pull request #4316 from 9rnsr/fix13860 Issue 13860 - template required forward reference for typeof(member)
Comment #3 by github-bugzilla — 2015-03-30T06:10:49Z
Comment #4 by github-bugzilla — 2015-06-17T21:03:34Z