Implicit cast of int to a class

Bill Baxter dnewsgroup at billbaxter.com
Sat Nov 3 23:20:19 PDT 2007


>>> // 1.
>>> void func (T) (T input = 0) // error:  cannot implicitly convert 
>>> expression (0) of type int to gmp.mpz.mpz_class
> 
> 
> For structs, I think this should work, but it doesn't.  I was going to 
> file a bug about it, but never got around to it.  In my particular case 
> I was trying to make an array-like struct, and got bitten by the fact 
> that I could use my opAssign to use "MyStruct foo=null" as a default 

could *not* use it as a defaulted argument, that is...

--bb


More information about the Digitalmars-d-learn mailing list