--- test.d --- struct HANDLE { size_t Value; this(void *ptrValue) { Value=ptrValue; } } enum HANDLE INVALID_HANDLE_VALUE = HANDLE(-1); static assert(INVALID_HANDLE_VALUE.Value == -1); class File { HANDLE Handle=INVALID_HANDLE_VALUE; } --- >dmd -c test.d -w -o- -debug --- e = 00A547EC, ty = 37 _error_ 009E16D8 Assertion failure: '0' on line 1483 in file 'expression.c' abnormal program termination --- Digital Mars D Compiler v2.048
workaround: remove assert
PATCH: staticassert.c, line 58. void StaticAssert::semantic2(Scope *sc) { Expression *e; //printf("StaticAssert::semantic2() %s\n", toChars()); e = exp->semantic(sc); + if (e->op == TOKerror) + return; e = e->optimize(WANTvalue | WANTinterpret); if (e->isBool(FALSE))
http://www.dsource.org/projects/dmd/changeset/711