[Issue 671] Weird class reference declaration compiles

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 9 21:41:12 PST 2006


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





------- Comment #2 from ibisbasenji at gmail.com  2006-12-09 23:41 -------
(In reply to comment #1)
> opAssign isn't for object construction. The object t was never created or
> constructed.
> 

No doubt, though I would argue this is one specific case the compiler could
catch and issue an error on (attempt to initialize object variable with
non-object).  

Either that or rewrite 'Class var = 42' as 'Class var = (new Class) = 42' such
that it works with any class defining a default constructor.  I'm not saying
I'm fond of that idea (not entirely fond of opAssign at all) but it would seem
a natural enough evolution.


-- 




More information about the Digitalmars-d-bugs mailing list