Bug 7983 – ICE with getMember on a unittest member

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-24T16:06:00Z
Last change time
2012-04-28T22:54:06Z
Keywords
ice, pull
Assigned to
nobody
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2012-04-24T16:06:46Z
Minimized code: class A { void f() { g(this); } unittest { } } void g(T)(T a) { foreach (name; __traits(allMembers, T)) { pragma(msg, name); static if (__traits(compiles, &__traits(getMember, a, name))) { } } } Compiler output: $ dmd -c bug.d f __unittest1 dmd: expression.c:6890: virtual Expression* DotVarExp::semantic(Scope*): Assertion `type' failed. Aborted $ Output from the pragma(msg,...) shows that the problem is triggered when getMember is called with the name of a unittest. However, moving the body of g() inside f() makes the problem go away, so there seems to be more to the problem than just the fact that getMember was called with a unittest argument.
Comment #1 by k.hara.pg — 2012-04-24T17:36:44Z
Comment #2 by github-bugzilla — 2012-04-26T20:03:44Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0e2c31f15fb6bb9809c0ff65b639aa1d76da4d91 fix Issue 7983 - ICE with getMember on a unittest member Front-end should not switch its semantic process by global.params.useUnitTests. https://github.com/D-Programming-Language/dmd/commit/e0fcf85e13d2cb0b82189927c3a5eb52a47343a2 Merge pull request #906 from 9rnsr/fix7983 Issue 7983 - ICE with getMember on a unittest member
Comment #3 by bugzilla — 2012-04-28T22:17:20Z
Fix by making unittests not a member enumerated by allMembers. They really aren't designed to be manipulated by the user.
Comment #4 by github-bugzilla — 2012-04-28T22:53:35Z