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.