atilaneves / automem

C++-style automatic memory management smart pointers for D
BSD 3-Clause "New" or "Revised" License
86 stars 15 forks source link

Can't compile with gdc 9.2.0 #35

Closed KingDuckZ closed 5 years ago

KingDuckZ commented 5 years ago

I'm interested in trying this library but unfortunately when I add it to my project I can't compile it:

[1/8] Compiling D object 'subprojects/automem/83545ae@@automem@sha/automem_source_automem_array.d.o'.
FAILED: subprojects/automem/83545ae@@automem@sha/automem_source_automem_array.d.o 
gdc -Isubprojects/automem/83545ae@@automem@sha -Isubprojects/automem -I../../../code/d/snake/subprojects/automem -I../../../code/d/snake/subprojects/automem/automem/source -fdiagnostics-color=always -Wall -Wdeprecated -g -fdebug -fPIC -MD -MQ 'subprojects/automem/83545ae@@automem@sha/automem_source_automem_array.d.o' -MF 'subprojects/automem/83545ae@@automem@sha/automem_source_automem_array.d.o.deps' -o 'subprojects/automem/83545ae@@automem@sha/automem_source_automem_array.d.o' -c ../../../code/d/snake/subprojects/automem/automem/source/automem/array.d
/home/michele/dev/code/d/snake/subprojects/automem/automem/source/automem/vector.d:308:11: error: statement expected to be { }, not (
  308 |         in(start >= 0)
      |           ^
/home/michele/dev/code/d/snake/subprojects/automem/automem/source/automem/vector.d:310:9: error: found 'do' when expecting ';' following statement
  310 |         do
      |         ^
/home/michele/dev/code/d/snake/subprojects/automem/automem/source/automem/vector.d:311:5: error: missing body { ... } after in or out
  311 |     {
      |     ^
ninja: build stopped: subcommand failed.

I'm quite new to D and I'm not sure what that syntax means but it looks like gdc doesn't understand it either.

atilaneves commented 5 years ago

That's because the gdc frontend is quite old. I'm not currently interested in supporting older compilers. Is there any reason you can't use ldc or dmd?

KingDuckZ commented 5 years ago

I'm using 9.2.0, which should be the latest version. As far as I know dmd is just horrible at generating assembly. I can try with ldc which should be pretty close to the quality of gcc, it's just extra stuff I have to install. Should I raise this problem with ibuclaw then (the guy behind gdc)?

I also mix D and C++ code a lot and I'm not sure dmd likes that. Since I use g++ anyways for me gdc was a natural choice. Again, I can try llvm since they also have a C++ compiler.

atilaneves commented 5 years ago

I'm using 9.2.0, which should be the latest version

It's the latest version of gdc, yes. I just tried compiling this with gdc 9.2.0:

pragma(msg, __VERSION__);

Which tells me the frontend version is 2.076. Currently dmd is at version 2.088.1.

As far as I know dmd is just horrible at generating assembly

I wouldn't call it horrible. But definitely not as fast as what the LLVM or gcc backends generate. A rule of thumb is that it's about 2x as slow. Personally, I only use ldc if I can even notice the binary running. Which usually doesn't even happen.

it's just extra stuff I have to install.

curl -fsS https://dlang.org/install.sh | bash -s ldc-1.18.0

Should I raise this problem with ibuclaw then (the guy behind gdc)?

No, gdc will catch up eventually.

I also mix D and C++ code a lot and I'm not sure dmd likes that

It shouldn't matter.

Again, I can try llvm since they also have a C++ compiler.

I'm going to close this because I don't want to support very old frontends. But you can fork this and remove or port all of the contracts.