[Issue 10375] New: private template from imported module hijacks a template type parameter(!)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 16 04:34:05 PDT 2013


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

           Summary: private template from imported module hijacks a
                    template type parameter(!)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dmitry.olsh at gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-06-16 04:34:03 PDT ---
Example:

import std.typetuple;

void packIt(Pack)(Pack p){ }  //3

void main()
{
    packIt!(int)(2); //7
}

Produces:
bug_alias.d(3): Error: module bug_alias std.typetuple.Pack(T...) is private
bug_alias.d(7): Error: template instance bug_alias.packIt!(int) error
instantiating

Used a recent dmd from github master HEAD.

Related code from std.typetuple:

private template Pack(T...)
{
    alias T tuple;

    // For convenience
    template equals(U...)
    {
        static if (T.length == U.length)
        {
            static if (T.length == 0)
                enum equals = true;
            else
                enum equals = isSame!(T[0], U[0]) &&
                    Pack!(T[1 .. $]).equals!(U[1 .. $]);
        }
        else
        {
            enum equals = false;
        }
    }
}

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


More information about the Digitalmars-d-bugs mailing list