Bug 24764 – ICE when -vcg-ast prints imported invariant
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-09-12T13:25:53Z
Last change time
2024-11-16T23:27:14Z
Keywords
ice, pull
Assigned to
No Owner
Creator
Dennis
Comments
Comment #0 by dkorpel — 2024-09-12T13:25:53Z
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);
}
}
```
Comment #1 by dlang-bot — 2024-10-03T10:48:13Z
@dkorpel created dlang/dmd pull request #16917 "Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant" fixing this issue:
- Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant
https://github.com/dlang/dmd/pull/16917
Comment #2 by dlang-bot — 2024-10-03T11:47:25Z
dlang/dmd pull request #16917 "Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant" was merged into stable:
- c52c26276b6dc70054bbd6eac58c4d13445ab16b by Dennis Korpel:
Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant
https://github.com/dlang/dmd/pull/16917
Comment #3 by dlang-bot — 2024-10-07T09:00:29Z
dlang/dmd pull request #16967 "Rebase stable6" was merged into master:
- c58361f46f9a4b20d8933a397d1ca34db2a40b65 by Dennis:
Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant (#16917)
Co-authored-by: Dennis Korpel <[email protected]>
https://github.com/dlang/dmd/pull/16967
Comment #4 by dlang-bot — 2024-11-16T23:27:14Z
dlang/dmd pull request #17069 "Merge stable" was merged into master:
- e0259d92e7fada37ae5c8e784704056f8a5aefd0 by Dennis:
Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant (#16917)
Co-authored-by: Dennis Korpel <[email protected]>
https://github.com/dlang/dmd/pull/17069