www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16013] New: [REG2.072a] ICE with mutually dependent structs

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

          Issue ID: 16013
           Summary: [REG2.072a] ICE with mutually dependent structs and
                    alias this
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: ice
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

This has two variants that trigger different ICEs. These are further reductions
of issue 16012, but that one is no ICE, and these ICEs are more recent
regressions.

Both tests compile with dmd 2.071, and they fail with git master (bc74f4a).

Variant 1 fails in statement.d, line 931.

test1.d:
----
struct Impl { S _payload; }

struct RefCounted
{
    void opAssign(RefCounted rhs) {}
    void opAssign(S rhs) {}
    S refCountedPayload() { return S.init; }
    alias refCountedPayload this;
}

struct S { RefCounted s; }
----

Output of `dmd -c test1.d`:
----
core.exception.AssertError statement.d(931): Assertion failure
----------------
??:? _d_assert [0x6e4493]
??:? void ddmd.statement.__assert(int) [0x5f7074]
??:? ddmd.statement.ErrorStatement ddmd.statement.ErrorStatement.__ctor()
[0x5e649c]
??:? _ZN12ExpStatement8semanticEP5Scope [0x5e6d4e]
??:? _ZN17CompoundStatement8semanticEP5Scope [0x5e7722]
??:? _ZN15FuncDeclaration9semantic3EP5Scope [0x5822b4]
??:? _ZN15FuncDeclaration9semantic3EP5Scope [0x58114c]
??:? _ZN20AggregateDeclaration9semantic3EP5Scope [0x4e0b2d]
??:? _ZN6Module9semantic3Ev [0x52fe51]
??:? int ddmd.mars.tryMain(ulong, const(char)**) [0x5af185]
??:? _Dmain [0x5afcae]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x6e64f6]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x6e6440]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll() [0x6e64b2]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x6e6440]
??:? _d_run_main [0x6e63b1]
??:? main [0x5b0205]
??:? __libc_start_main [0x9c1a882f]
----

Variant 2 fails in glue.c, line 1519.

test2.d:
----
S s; /* Only this line has changed from above. */

struct RefCounted
{
    void opAssign(RefCounted rhs) {}
    void opAssign(S rhs) {}
    S refCountedPayload() { return S.init; }
    alias refCountedPayload this;
}

struct S { RefCounted s; }
----

Output of `dmd -c test2.d`:
----
dmd: glue.c:1519: unsigned int totym(Type*): Assertion `0' failed.
Aborted (core dumped)
----

--
May 10 2016