[Issue 7815] Mixin template forward reference (?) regression

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed May 13 14:38:17 PDT 2015


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

--- Comment #18 from github-bugzilla at puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d0c854a1722c286777c5e48e0780e5318a986f49
Move issue 7815 case to fail_compilation, because it was invalid

It was wrongly accepted by the bug in `StaticIfCondition::include()`.

Bug explanation copied from fail_compilation/fail7815.d:
----
When the Move struct member is analyzed:
1. mixin Helpers!() is instantiated.
2. In Helpers!(), static if and its condition is(Flags!Move)) evaluated.
3. In Flags!Move, string mixin evaluates and CTFE lambda.
4. __traits(derivedMembers, Move) tries to see the member of Move.
   4a. mixin Helpers!() member is analyzed.
   4b. `static if (is(Flags!Move))` in Helpers!() is evaluated
   4c. The Flags!Move instantiation is already in progress, so it cannot be
resolved.
   4d. `static if` fails because Flags!Move cannot be determined as a type.
5. __traits(derivedMembers, Move) returns a 1-length tuple("a").
6. The lambda in Flags!Move returns a string "struct Flags {...}", then
   Flags!Move is instantiated to a new struct Flags.
7. Finally Move struct does not have flags member, then the `enum a7815`
   definition will fail in its initializer.

--


More information about the Digitalmars-d-bugs mailing list