tupleof.length of a class in a template return 0

SomeDude lovelydear at mailmetrash.com
Wed Apr 18 09:56:38 PDT 2012


On Tuesday, 17 April 2012 at 00:04:16 UTC, Michaël Larouche 
wrote:
> My template works with a struct but when I try to mixin my 
> template in a class, I get compile error because 
> T.tupleof.length returns 0.
>
> Here's the whole code:
> http://ideone.com/UR6YU

For what it's worth, dmd 2.059 (it seems you are using v2.042) 
gives this message:

serial.d(21): Error: class serial.MyObject no size yet for 
forward reference
serial.d(11): Error: template instance 
serial.GenerateFieldSerialization!(MyObject,0,"m_id","m_data","AMethod","AutoDelete","AnotherMethod","RefCount","Method1","toString","toHash","opCmp","opEquals","Monitor","factory") 
error instantiating

According to Kenji Hara, "tupleof property requires complete 
semantic analysis to get the fields of a type."

http://d.puremagic.com/issues/show_bug.cgi?id=7249

If you haven't solved your problem yet, you may try the 
workaround described or have a look at the result of googling 
this:
"no size yet for forward reference" site:digitalmars.com/d



More information about the Digitalmars-d-learn mailing list