[Issue 1336] New: Internal error when trying to construct a class declared within a unittest from a templated class.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 11 16:17:53 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1336

           Summary: Internal error when trying to construct a class declared
                    within a unittest from a templated class.
           Product: D
           Version: 1.018
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: aaroncraelius at gmail.com


A templated class instantiated with a class declared in a unittest block cannot
call the constructor for that class, but instead of writing an error the
compiler returns:
Internal error: toir.c 182

The following code will cause this error to appear:
class X(T)
{
        void test()
        {
                auto t = new T;
        }
}

unittest
{
        class DummyClass
        {
        }

        auto x = new X!(DummyClass);
}

The code compiles fine if it is changed to this:
class X(T)
{
        void test()
        {
                auto t = new T;
        }
}

class DummyClass
{
}

unittest
{
        auto x = new X!(DummyClass);
}


-- 



More information about the Digitalmars-d-bugs mailing list