the following code is not valid but instead of producing an error message, hits ICE
dmd: statement.c:756: ErrorStatement::ErrorStatement(): Assertion `global.gaggedErrors || global.errors' failed.
import std.typecons;
import std.typetuple;
template X (T)
{
static if (is (typeof(T.init.bar) ))
X U;
else alias X = T;
}
struct Y ()
{
this (){}
~this (){this = null;}
ref opAssign (S)(S){}
}
struct Z () { }
template foo ()
{
auto foo ()
{
auto args = tuple ;
static if (is (Data))
0;
return Z!((args.baz.expand))();
}
}
auto baz (T)(T)
{
staticMap!(X, T) abc;
return tuple;
}
auto bar (R)(R )
{Y!();}
void main ()
{
foo;
}
Comment #1 by vlevenfeld — 2014-12-21T21:52:13Z
here is dmd backtrace:
#0 0x00007ffff70c91a5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff70cc420 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff70c2351 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00000000004513d7 in ErrorStatement::ErrorStatement (this=0x1bff7470) at statement.c:756
#4 0x0000000000451727 in ExpStatement::semantic (this=0x183c0720, sc=0x1babb190) at statement.c:837
#5 0x000000000045214d in CompoundStatement::semantic (this=0x183c0740, sc=0x1babb190) at statement.c:1035
#6 0x000000000053de94 in FuncDeclaration::semantic3 (this=0x183c04d0, sc=0x183be0f0) at func.c:1513
#7 0x00000000005415fc in FuncDeclaration::functionSemantic3 (this=0x183c04d0) at func.c:2229
#8 0x0000000000541565 in FuncDeclaration::functionSemantic (this=0x183c04d0) at func.c:2210
#9 0x00000000005199fa in DotVarExp::semantic (this=0x1bff7140, sc=0x1ba72370) at expression.c:7485
#10 0x0000000000514cb0 in UnaExp::unaSemantic (this=0x1bff7190, sc=0x1ba72370) at expression.c:6432
#11 0x000000000051d1fc in CallExp::semantic (this=0x1bff7190, sc=0x1ba72370) at expression.c:8244
#12 0x00000000004f4f25 in VarDeclaration::semantic (this=0x1bff6fe0, sc=0x1ba72370) at declaration.c:1464
#13 0x000000000053d51d in FuncDeclaration::semantic3 (this=0x1839df80, sc=0x1ab33d30) at func.c:1405
#14 0x000000000047f71b in TemplateInstance::semantic3 (this=0x1839dae0, sc=0x0) at template.c:7441
#15 0x0000000000409e36 in Module::runDeferredSemantic3 () at module.c:968
#16 0x0000000000406171 in tryMain (argc=97, argv=0x729b80) at mars.c:1579
#17 0x0000000000406c84 in main (argc=93, argv=0x7fffffffdc88) at mars.c:1782
Comment #2 by vlevenfeld — 2014-12-21T22:09:46Z
"this" at backtrace level #4 refers to an ExpStatement whose loc is at the "this = null" line