Bug 15333 – Assertion failed: (!fd->vthis->csym), function FuncDeclaration_toObjFile, file glue.c, line 1034.
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-14T04:12:00Z
Last change time
2016-10-01T11:45:01Z
Keywords
ice, pull
Assigned to
nobody
Creator
deadalnix
Comments
Comment #0 by deadalnix — 2015-11-14T04:12:43Z
Code :
d/semantic/statement.d
module d.semantic.statement;
struct StatementVisitor {
void visit() {
Expression iterated;
import d.semantic.identifier;
SymbolResolver!((e) {
new CompileError(
iterated.location,
e.toString,
);
})().resolveInExpression(iterated.location, iterated);
}
}
class CompileError {
this(Location , string ) {
}
}
struct Location {}
class Expression {
Location location;
}
*************
d/semantic/identifier.d
module d.semantic.identifier;
alias SymbolResolver(alias handler) = IdentifierResolver!(handler, false);
/**
* Resolve identifier!(arguments).identifier as type or expression.
*/
struct TemplateDotIdentifierResolver(alias handler, bool asAlias) {
alias Ret = typeof(handler);
Ret resolve(TemplateInstanciationDotIdentifier i) {
import std.algorithm;
i.templateInstanciation.arguments.map!((a) {
});
handler(i);
}
}
/**
* General entry point to resolve identifiers.
*/
struct IdentifierResolver(alias handler, bool asAlias) {
alias Ret = typeof(handler);
import d.semantic.statement;
Ret resolveInExpression(Location , Expression) {
}
Ret visit(TemplateInstanciationDotIdentifier i) {
TemplateDotIdentifierResolver!(handler, asAlias)().resolve(i);
}
}
class TemplateInstanciationDotIdentifier {
TemplateInstanciation templateInstanciation;
}
class TemplateInstanciation {
uint[] arguments;
}
***********
util/visitor.d
auto dispatch(
alias unhandled = {
// XXX: Buggy for some reason.
// throw new Exception(typeid(t).toString() ~ " is not supported by visitor " ~ typeid(V).toString() ~ " .");
}, V, T)(V visitor, T t) {
return dispatchImpl!unhandled(visitor, t);
}
auto dispatchImpl(
alias unhandled, V, T)(V visitor, T t) {
alias o = t;
import std.traits;
import std.typetuple;
alias Members = TypeTuple!(__traits(getOverloads, V, "visit"));
foreach(visit; Members) {
alias parameters = ParameterTypeTuple!visit;
alias parameter = parameters;
return visitor.visit({
return fastCast!parameter(o);
} ());
}
}
U fastCast(U, T)(T t) {
return *cast(U*) t;
}
****************
Yeah the code is gnarly, this is the best reduction i can have so far.
$ dmd -c -oflibd.o d/semantic/identifier.d d/semantic/statement.d -m64 -inline
Assertion failed: (!fd->vthis->csym), function FuncDeclaration_toObjFile, file glue.c, line 1034.
That makes it impossible to create an optimized build of SDC :'(