www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14844] New: dmd-2.068.0-b2 attrib.c:1233: virtual Dsymbols*

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

          Issue ID: 14844
           Summary: dmd-2.068.0-b2 attrib.c:1233: virtual Dsymbols*
                    StaticIfDeclaration::include(Scope*, ScopeDsymbol*):
                    Assertion `scopesym' failed
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: wikodes gmail.com

Compiler: dmd-2.068.beta2

Reduced code with dustmite. It isn't valid D code any more but reproduces the
compiler bug that occurred when compiling the complete source.

Compiler message:
dmd: attrib.c:1233: virtual Dsymbols* StaticIfDeclaration::include(Scope*,
ScopeDsymbol*): Assertion `scopesym' failed.

Code:
module app;

import std.string;

import std.typecons;

static this() {
    runUnitTests!app;
}

alias CppNs = Typedef!string;

bool runUnitTests(COMPOSITES...)() {
    g_runner.runUnitTests!COMPOSITES;
}

class TestRunner {
    bool runUnitTests(COMPOSITES...)() {
        foreach (comp; COMPOSITES)
            if (runUnitTestsImpl!comp)
                ret;
    }

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

}

TestRunner g_runner;
template isModule(DECL...) {
    enum isModule = DECL[0].stringof.startsWith("module ");
}

--
Jul 28 2015