← Back to index
|
Original Bugzilla link
Bug 10373 – cannot resolve forward reference (dmd2.063)
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-16T02:16:00Z
Last change time
2013-06-23T19:40:46Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
coz.d.lang
Comments
Comment #0
by coz.d.lang — 2013-06-16T02:16:37Z
/** * Main.d */ private import std.traits; struct Test0(T, int N=0) { static if (N == 0) { T[] mBuffer; } else { T[N] mBuffer; } static if (is(T == class)){} else { T* at_(size_t n) { return &mBuffer[n]; } static if (is(typeof(*at_(0) = T.init))) { T opIndexAssign(T value, size_t index) { return (*at_(index) = value); } } } } struct Test1(T, int N=0) { static if (is(T == class)){} else { T* at_(size_t n) { return &mBuffer[n]; } static if (is(typeof(*at_(0) = T.init))) { T opIndexAssign(T value, size_t index) { return (*at_(index) = value); } } } static if (N == 0) { T[] mBuffer; } else { T[N] mBuffer; } } struct Test2(T, int N=0) { static if (is(T == class)){} else { T* at_(size_t n) { return &mBuffer[n]; } static if (std.traits.isMutable!T) { T opIndexAssign(T value, size_t index) { return (*at_(index) = value); } } } static if (N == 0) { T[] mBuffer; } else { T[N] mBuffer; } } void main() { static if (is(Test0!(int, 2))) pragma(msg, "Test0 is OK"); else pragma(msg, "Test0 is NG"); static if (is(Test1!(int, 2))) pragma(msg, "Test1 is OK"); else pragma(msg, "Test1 is NG"); static if (is(Test2!(int, 2))) pragma(msg, "Test2 is OK"); else pragma(msg, "Test2 is NG"); Test0!(int, 2) test0; // OK(dmd2.062) OK (dmd2.063) Test1!(int, 2) test1; // OK(dmd2.062) NG (dmd2.063) Test2!(int, 2) test2; // OK(dmd2.062) OK (dmd2.063) /+ output dmd2.063 Test0 is OK Main.d(24): Error: undefined identifier mBuffer Test1 is NG Test2 is OK Main.d(24): Error: undefined identifier mBuffer Main.d(49): Error: template instance Main.Test1!(int, 2) cannot resolve forward reference Main.d(26): Error: this for at_ needs to be type Test1 not type Test1 Main.d(55): Error: template instance Main.Test1!(int, 2) error instantiating +/ }
Comment #1
by k.hara.pg — 2013-06-17T17:18:07Z
https://github.com/D-Programming-Language/dmd/pull/2192
Comment #2
by github-bugzilla — 2013-06-23T19:35:56Z
Commits pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/f527c4171e34f8e7a52b83addc787bfd5b73402d
fix Issue 10373 - cannot resolve forward reference
https://github.com/D-Programming-Language/dmd/commit/97810dedfc7c13b489be3920c8e5c97f9b90d164
Merge pull request #2192 from 9rnsr/fix10373 [REG2.063] Issue 10373 - cannot resolve forward reference
Comment #3
by github-bugzilla — 2013-06-23T19:40:31Z
Commit pushed to 2.063 at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/65a72737658522e957745adc52aede6e56d003a7
Merge pull request #2192 from 9rnsr/fix10373 [REG2.063] Issue 10373 - cannot resolve forward reference