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

           Summary: Can no longer create a const Date in CTFE if the
                    variable is explicitly typed
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Jonathan M Davis <[email protected]> 2013-03-21 02:15:15 
PDT ---
In 2.061, this compiled:

import std.datetime;
const Date date = Date(2012, 12, 21);
void main() {}

In 2.062 (and the current master), it gives

/usr/include/D/phobos/std/datetime.d(13542): Error: Internal Compiler Error:
CTFE literal cast(short)1
dmd: ctfeexpr.c:353: Expression* copyLiteral(Expression*): Assertion `0'
failed.
Aborted (core dumped)

It works if it's changed to

import std.datetime;
const date = Date(2012, 12, 21);
void main() {}

It also works if date is made non-const

Date date = Date(2012, 12, 21);

But it doesn't work even without const, if it's an enum

enum Date date = Date(2012, 12, 21);

though as with normal variables, if the type is not given explicitly to the
enum, it compiles just fine.

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

Reply via email to