initializing const(Date)

Jonathan M Davis jmdavisProg at gmx.com
Tue Mar 19 10:13:47 PDT 2013


On Tuesday, March 19, 2013 17:35:20 Dan wrote:
> This used to work but now in 2.062 it causes ctfe error.
> Any suggested workaround?
> 
> http://dpaste.dzfl.pl/f1a8c2f5
> -------------------------------------
> import std.datetime;
> const(Date) DefaultDate = Date(1929, 10, 29);
> void main() {
> 
> }
> -------------------------------------
> 
> Compilation output:
> /opt/compilers/dmd2/include/std/datetime.d(13542): Error:
> Internal Compiler Error: CTFE literal cast(short)1
> dmd: ctfeexpr.c:353: Expression* copyLiteral(Expression*):
> Assertion `0' failed.

It appears to work if you just do

const defaultDate = Date(1929, 10, 29);

But please report this as a regression:

http://d.puremagic.com/issues

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list