How to correctly generate enums at compile time.
Kevin Balbas via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 30 15:03:02 PDT 2017
On Sunday, 30 April 2017 at 21:31:22 UTC, jkpl wrote:
> On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote:
>> On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote:
>>> On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote:
>> Strangely enough, it does work fine in the test snippet,
>
> As well if you import the snippet in another module. That's
> what i tried to tell.
> try to reduce step by step; The problem cant be the stuff you
> mix.
I was able to fix the error by simplifying and slashing down my
actual code to a few hundred lines and 4 modules (3 plus a stub
main), and even then the error only goes away if I compile the
modules in a very specific order with dmd. Namely, both the
main() file and the file containing the enum have to be compiled
after all of the things that use the enum, and one of the two
dependents has to be compiled before the other. I have no idea
*why* that's the case, but it seems to be.
My actual project uses dub/visuald for building, so I don't
really tinker with file ordering. Is this a thing that's
supposed to happen?
More information about the Digitalmars-d-learn
mailing list