Thread overview
Illegal behaviour or GDC bug?
Oct 13, 2016
Peter Campbell
Oct 13, 2016
ketmar
Oct 13, 2016
Peter Campbell
Oct 13, 2016
ketmar
October 13, 2016
Good evening all, I'm just starting to learn D and I've been experimenting with some template stuff as well as checking out DMD, GDC and LDC. During my experimentation I found a piece of code that doesn't compile in GDC but does compile in DMD and LDC. The code snippet can be found here: http://dpaste.com/1BCVKSW

Basically it's a 3D vector with some enums that reference the structure itself. In GDC produces the following errors:

Line 9: error: cannot create a struct until its size is determined
Line 19: error: template instance Vector3.Vector3T!float error instantiating

I've seen this error in C++ before and I believe it's illegal behaviour in C++ land. In regard to D, both DMD and LDC seem to believe it's legal syntax and allow me to use it without problems.

Have I found a bug with GDC or should I not be able to do this?
October 13, 2016
sadly, gdc has way older frontend version than ldc (and dmd, of course). gdc is like 2.067, and ldc/dmd is 2.072. that this was fixed in later versions, but gdc is not updated yet.
October 13, 2016
On Thursday, 13 October 2016 at 20:18:31 UTC, ketmar wrote:
> sadly, gdc has way older frontend version than ldc (and dmd, of course). gdc is like 2.067, and ldc/dmd is 2.072. that this was fixed in later versions, but gdc is not updated yet.

OK that's cool, I'll just avoid GDC for now. Is it generally a good approach to assume if something compiles in DMD then it's correct and just hope that GDC/LDC pick up the latest version at some point?
October 13, 2016
On Thursday, 13 October 2016 at 20:22:51 UTC, Peter Campbell wrote:
> OK that's cool, I'll just avoid GDC for now. Is it generally a good approach to assume if something compiles in DMD then it's correct and just hope that GDC/LDC pick up the latest version at some point?

mostly yes. btw, ldc has devbuilds available from it's github page, those are usually on par with current dmd.

it is very sad that gdc has so little manpower, tho. Iain doing a great job, but...