www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5185] New: unittest in template classes: recursive template expansion error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5185

           Summary: unittest in template classes: recursive template
                    expansion error
           Product: D
           Version: D1
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: indigon mail.ru



It's very comfortable to place unittest code near functions.
But in template classes in some cases it cannot be done:

class C(V) {
    V v;

    void foo() {
    } unittest {
        C!(C!(int)) c; // Error: recursive template expansion for template
argument C!(int).C
    }
}

unittest {
    C!(C!(int)) c; // the same code here don't cause this error
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 07 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5185


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com
           Platform|x86                         |All
            Version|D1                          |D1 & D2
            Summary|unittest in template        |Recursive template
                   |classes: recursive template |expansion error in class
                   |expansion error             |method
         OS/Version|Windows                     |All



14:45:44 PST ---
Unrelated to unittests, and affects D2 too. Reduced:

class C(V)
{
    void f()
    {
        C!(C!(int)) c;  // NG
    }
}

void main()
{
    C!(C!(int)) c;  // ok
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 15 2013