concepts icon indicating copy to clipboard operation
concepts copied to clipboard

Incompatible with recent compilers

Open 0xEAB opened this issue 3 years ago • 0 comments

Unfortunately this library doesn’t work with recent D compilers.

In my case it’s the following error message:

/home/elias/.dub/packages/concepts-0.0.8/concepts/source/concepts/implements.d-mixin-27(39,32): Error: `;` expected
/home/elias/.dub/packages/concepts-0.0.8/concepts/source/concepts/implements.d-mixin-27(39,33): Error: declaration expected, not `(`
../../source/oceandrift/db/dbal/driver.d(230,33): Error: template instance `concepts.implements.implements!(SQLite3, DatabaseDriver)` error instantiating
../../source/oceandrift/db/sqlite3.d(185,15):        instantiated from here: `isDatabaseDriver!(SQLite3)`
../../source/oceandrift/db/sqlite3.d(185,1):        while evaluating: `static assert(isDatabaseDriver!(SQLite3))`

for roughly this code:

interface DatabaseDriver { /*…*/ }
enum bool isDatabaseDriver(T) = implements!(T, DatabaseDriver);

final class SQLite3 : DatabaseDriver { /* … */ }
static assert(isDatabaseDriver!SQLite3);

I venture to provide a reduced code sample for reproduction because the unittests of this library fail as well, and are probably a handier thing to work with anyway:

LDC

$ ldc2 --version
LDC - the LLVM D compiler (1.30.0):
  based on DMD v2.100.1 and LLVM 14.0.3
  built with LDC - the LLVM D compiler (1.30.0)
$ dub test concepts --compiler=ldc2
Building package concepts in /home/elias/.dub/packages/concepts-0.0.8/concepts/
Generating test runner configuration 'concepts-test-library' for 'library' (library).
Performing "unittest" build using ldc2 for x86_64.
concepts 0.0.8: building configuration "concepts-test-library"...
/home/elias/.dub/packages/concepts-0.0.8/concepts/source/concepts/implements.d(113,5): Error: static assert:  `!__traits(compiles, implements!(Bar, IFoo))` is false
ldc2 failed with exit code 1.

DMD

$ dmd --version
DMD64 D Compiler v2.100.1
$ dub test concepts --compiler=dmd
Building package concepts in /home/elias/.dub/packages/concepts-0.0.8/concepts/
Generating test runner configuration 'concepts-test-library' for 'library' (library).
Performing "unittest" build using dmd for x86_64.
concepts 0.0.8: building configuration "concepts-test-library"...
/home/elias/.dub/packages/concepts-0.0.8/concepts/source/concepts/implements.d(113,5): Error: static assert:  `!__traits(compiles, implements!(Bar, IFoo))` is false
dmd failed with exit code 1.

0xEAB avatar Sep 11 '22 15:09 0xEAB