[Issue 1253] array initializers as expressions are not allowed in const arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 1 08:24:14 PDT 2009


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


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

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




--- Comment #6 from Don <clugdbug at yahoo.com.au>  2009-09-01 08:24:13 PDT ---
And here's a patch.
Cause: The initializer is used in declaration.c, VarDeclaration::semantic().
We see the lines:
------
            Expression *e = init->toExpression();
            if (!e)
            {
            init = init->semantic(sc, type);
            e = init->toExpression();
            if (!e)
------
The initializer is supposed to return NULL if the initializer semantic hasn't
been run yet. But the array initializer doesn't -- it prints an error, and
returns an ErrorExp instead! It never has a chance.

PATCH: init.c, last lines of ArrayInitializer::toExpression() (around line
473).

Lno:
    delete elements;
-   error(loc, "array initializers as expressions are not allowed");
-   return new ErrorExp();
+    return NULL;
}

-- 
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