[Issue 14844] dmd-2.068.0-b2 attrib.c:1233: virtual Dsymbols* StaticIfDeclaration::include(Scope*, ScopeDsymbol*): Assertion `scopesym' failed

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 28 16:03:25 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14844

--- Comment #1 from Martin Nowak <code at dawg.eu> ---
A bit more reduced, but I don't understand enough of the
addMember/include/scope part of dmd to fix this.

module app;

import std.typecons;

alias CppNs = Typedef!string;

bool runUnitTestsImpl(alias COMPOSITE)() {
    foreach (M; __traits(allMembers, COMPOSITE))
        static if (__traits(compiles, __traits(getMember, COMPOSITE, M))
                   && !isModule!(__traits(getMember, COMPOSITE, M)))
            if (runUnitTestsImpl!(__traits(getMember, COMPOSITE, M)))
                return false;
    return true;
}

template isModule(alias DECL) {
    enum isModule = startsWith(DECL.stringof, "module ");
}

bool startsWith(Needle)(string doesThisStart, Needle withThis)
{
    return doesThisStart.length >= withThis.length &&
        doesThisStart[0 .. withThis.length] == withThis;
}

alias run = runUnitTestsImpl!app;

--


More information about the Digitalmars-d-bugs mailing list