www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18305] New: SysTime crashes ctfe

https://issues.dlang.org/show_bug.cgi?id=18305

          Issue ID: 18305
           Summary: SysTime crashes ctfe
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Steps to reproduce:

void main() { mixin({ return (SysTime.init is SysTime.init) ? "" : ""; }()); }

Expected:

nothing happens

Outcome:

Compiler crashes.

Observation:

I added some logging, and

test.d(5) BinExp::interpretCompareCommon() SysTime(0L, Rebindable(null, )) is
SysTime(0L, Rebindable(null, ))
ctfeIdentity op = 'TOKidentity', e1 = SysTime(0L, Rebindable(null, void)), e2 =
SysTime(0L, Rebindable(null, void))
test.d(5): Error: CTFE internal error: bad compare of void and void
core.exception.AssertError ddmd/ctfeexpr.d(1345): Assertion failure

It looks like the second field in RebindableCommon's union ends up
void-initialized, and CTFE can't figure out how to compare that.

--
Jan 26