This is a problem on the git master. This does not affect 2.052.
The program below causes an ICE on the git master version:
-------------------------------------------------
class K {
void f() {
static assert(0, typeof(this).stringof);
}
}
void main() {
(new K).f;
}
-------------------------------------------------
$ dmd2.052/osx/bin/dmd x # correct
x.d(6): Error: static assert "K"c
$ dmd x # incorrect
Assertion failed: (this != enclosing), function Scope, file scope.c, line 132.
Abort trap
-------------------------------------------------
And the program below thinks the template parameter U does not exist:
-------------------------------------------------
class K {
static void f(U)() {
static assert(0, U.stringof);
}
}
void main() {
K.f!int();
}
-------------------------------------------------
$ dmd2.052/osx/bin/dmd x # correct
x.d(6): Error: static assert "int"c
x.d(11): instantiated from here: f!(int)
$ dmd x # incorrect
x.d(6): Error: undefined identifier U
x.d(6): Error: static assert __error
x.d(11): instantiated from here: f!(int)
-------------------------------------------------