September 12
https://issues.dlang.org/show_bug.cgi?id=24764

          Issue ID: 24764
           Summary: ICE when -vcg-ast prints imported invariant
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: dkorpel@live.nl

Reduced from `imported!"std.outbuffer"`:

```
// a.d
template imported()
{
    import imported = b;
}

alias x = imported!();
```

```
// b.d
struct O
{
    invariant() {}
}
```

When compiling `dmd -vcg-ast a.d` you get:

```
core.exception.AssertError@src/dmd/hdrgen.d(1863): Assertion failure
```

The code in question being:

```D
void visitInvariantDeclaration(InvariantDeclaration d)
    {
        if (hgs.hdrgen)
            return;
        if (stcToBuffer(buf, d.storage_class))
            buf.writeByte(' ');
        buf.writestring("invariant");
        if(auto es = d.fbody.isExpStatement())
        {
            assert(es.exp && es.exp.op == EXP.assert_); // FAILS, it's EXP.call
            buf.writestring(" (");
            (cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
            buf.writestring(");");
            buf.writenl();
        }
        else
        {
            bodyToBuffer(d);
        }
    }
```

--