Bug 9806 – assertion failure in struct.c:668

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-24T04:20:00Z
Last change time
2013-04-02T14:05:47Z
Keywords
ice, pull
Assigned to
nobody
Creator
nilsbossung

Comments

Comment #0 by nilsbossung — 2013-03-24T04:20:54Z
Fails with v2.063-devel-618d827. Compiles with v2.062. --- cat > test.d <<code struct S(alias x) { alias S!0 N; } enum expr = 0 * 0; alias S!expr T; code dmd -c -o- test.d --- dmd: struct.c:668: virtual void StructDeclaration::semantic(Scope*): Assertion `type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed. Aborted (core dumped) ---
Comment #1 by k.hara.pg — 2013-04-01T08:34:15Z
Comment #2 by nilsbossung — 2013-04-01T12:38:59Z
This slight variation still fails: --- cat > test.d <<code struct S(alias x) { template Next() { enum expr = x + 1; alias S!expr Next; } } alias S!1 One; alias S!0.Next!() OneAgain; code dmd -c -o- test.d --- dmd: struct.c:722: virtual void StructDeclaration::semantic(Scope*): Assertion `type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed. Aborted (core dumped) ---
Comment #3 by k.hara.pg — 2013-04-01T18:15:12Z
(In reply to comment #2) > This slight variation still fails: > > --- > cat > test.d <<code > struct S(alias x) > { > template Next() > { > enum expr = x + 1; > alias S!expr Next; > } > } > alias S!1 One; > alias S!0.Next!() OneAgain; > code > dmd -c -o- test.d > --- > dmd: struct.c:722: virtual void StructDeclaration::semantic(Scope*): Assertion > `type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed. > Aborted (core dumped) > --- I updated my pull request to fix it.
Comment #4 by nilsbossung — 2013-04-02T02:37:39Z
Still fails with a tuple parameter: --- cat > test.d <<code struct S(x ...) { template Next() { enum expr = x[0] + 1; alias S!expr Next; } } alias S!1 One; alias S!0.Next!() OneAgain; code dmd -c -o- test.d --- dmd: struct.c:722: virtual void StructDeclaration::semantic(Scope*): Assertion `type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed. Aborted (core dumped) ---
Comment #5 by k.hara.pg — 2013-04-02T04:23:49Z
(In reply to comment #4) > Still fails with a tuple parameter: [snip] Updated. Thanks to good test cases.
Comment #6 by nilsbossung — 2013-04-02T04:59:36Z
Alright, my code compiles again. You're the man, Kenji.
Comment #7 by github-bugzilla — 2013-04-02T14:04:28Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2cbe9b1b389f3617e70ffbdbe20f6b30aeac9d10 fix Issue 9806 - assertion failure in struct.c:668 - Save Scope object to resolve forward references - Do constant folding in template value argument comparison Additional: Add assertions to check AST identity in `ClassDeclaration::semantic` and `InterfaceDeclaration::semantic`. https://github.com/D-Programming-Language/dmd/commit/ca458073b3bdb0a0bc768e4eb062fb533eaac995 Merge pull request #1822 from 9rnsr/fix9806 [REG2.063a] Issue 9806 - assertion failure in struct.c:668