[Issue 15333] New: Assertion failed: (!fd->vthis->csym), function FuncDeclaration_toObjFile, file glue.c, line 1034.
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Nov 13 20:12:43 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15333
Issue ID: 15333
Summary: Assertion failed: (!fd->vthis->csym), function
FuncDeclaration_toObjFile, file glue.c, line 1034.
Product: D
Version: D2
Hardware: x86
OS: Mac OS X
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: deadalnix at gmail.com
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 :'(
--
More information about the Digitalmars-d-bugs
mailing list