[Issue 3367] Regression: struct initialization no longer supports ctor overloads

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 29 12:58:45 PDT 2009


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #2 from Don <clugdbug at yahoo.com.au> 2009-10-29 12:58:44 PDT ---
PATCH: declaration.c, line 1094.
            {
            /* Look for opCall
             * See bugzilla 2702 for more discussion
             */
            Type *ti = ei->exp->type->toBasetype();
------- ADD THIS CODE:            
            // Look for ctor
            if (sd->ctor && 
                /* Initializing with the same type is done differently
                 */
                !(ti->ty == Tstruct && t->toDsymbol(sc) == ti->toDsymbol(sc)))
{
               // Rewrite as e1.call(arguments)
                Expression * eCall = new DotIdExp(loc, e1, Id::ctor);
                ei->exp = new CallExp(loc, eCall, ei->exp);
            } 
            else
-----------
            // Don't cast away invariant or mutability in initializer
            if (search_function(sd, Id::call) &&

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list