Illegal behaviour or GDC bug?

Peter Campbell via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 13 12:46:06 PDT 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?


More information about the Digitalmars-d-learn mailing list