libmir / mir-ion

Ion, JSON, YAML, CSV, CBOR and Msgpack serialization framework
Apache License 2.0
14 stars 6 forks source link

Latest `mir-ion`, `mir-algorithm` and `mir-core` do not build with any DMD version #41

Open VPanteleev-S7 opened 1 year ago

VPanteleev-S7 commented 1 year ago

I'm trying to build a project which uses Mir, however, the build does not succeed. (I am guessing that it maybe succeeded with older versions of dub.selections.json but the project did not commit its lockfile.)

I reduced the build error to the following:

dmd \
    -I~/.dub/packages/mir-ion/2.2.0/mir-ion/source/ \
    -I~/.dub/packages/mir-algorithm/3.21.0/mir-algorithm/source/ \
    -I~/.dub/packages/mir-core/1.6.0/mir-core/source/ \
    ~/.dub/packages/mir-ion/2.2.0/mir-ion/source/mir/yaml/internal/token.d \
    ~/.dub/packages/mir-algorithm/3.21.0/mir-algorithm/source/mir/algebraic_alias/ion.d \
    ~/.dub/packages/mir-core/1.6.0/mir-core/source/mir/algebraic.d

It fails with:

.../.dub/packages/mir-core/1.6.0/mir-core/source/mir/algebraic.d(1474): Error: `pure` function `mir.algebraic.Algebraic!(Ion_).Algebraic.opEquals!().opEquals` cannot call impure function `mir.annotated.U!(Algebraic!(Ion_)).Annotated.opEquals`
.../.dub/packages/mir-core/1.6.0/mir-core/source/mir/algebraic.d(1474): Error: `@nogc` function `mir.algebraic.Algebraic!(Ion_).Algebraic.opEquals!().opEquals` cannot call non-@nogc function `mir.annotated.U!(Algebraic!(Ion_)).Annotated.opEquals`
.../.dub/packages/mir-core/1.6.0/mir-core/source/mir/algebraic.d(1474): Error: function `mir.annotated.U!(Algebraic!(Ion_)).Annotated.opEquals` is not `nothrow`
.../.dub/packages/mir-core/1.6.0/mir-core/source/mir/algebraic.d(1429): Error: function `mir.algebraic.Algebraic!(Ion_).Algebraic.opEquals!().opEquals` may throw but is marked as `nothrow`
.../.dub/packages/mir-algorithm/3.21.0/mir-algorithm/source/mir/annotated.d(69): Error: template instance `mir.algebraic.Algebraic!(Ion_).Algebraic.opEquals!()` error instantiating
.../.dub/packages/mir-core/1.6.0/mir-core/source/mir/internal/meta.d(683):        instantiated from here: `U!(Algebraic!(Ion_))`
.../.dub/packages/mir-core/1.6.0/mir-core/source/mir/algebraic.d(858):        12 recursive instantiations from here: `ReplaceTypeUnless!(isVariant, This, Algebraic!(Ion_), typeof(null), bool, long, double, string, Blob, Clob, Timestamp, This[], StringMap!(This), Annotated!(This))`
.../.dub/packages/mir-algorithm/3.21.0/mir-algorithm/source/mir/algebraic_alias/ion.d(60):        instantiated from here: `Algebraic!(Ion_)`

I am not sure where the problem lies, but I tried all recent DMD releases and it doesn't work with any of them.

VPanteleev-S7 commented 1 year ago

Ah, this might be a DMD bug. If I reorder the files, it does compile successfully...