www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1514] New: mixin doesn't make the template to "function template"

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

           Summary: mixin doesn't make the template to "function template"
           Product: D
           Version: 1.014
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


import std.stdio;
template prerequisite(T)
{
        static assert(T.max==int.max);
        alias T type;
}

template mytemp(T)
{
        mixin subtemp!(T);
        template subtemp(U:prerequisite!(T).type)
        {
                void mytemp(T v)
                {
                        writefln(v);
                }
        }
}

void main()
{
        mytemp(3);
}


-- 
Sep 17 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1514





------- Comment #1 from davidl 126.com  2007-09-18 01:00 -------
simplified case
abc.d:
import std.stdio;

template mytemp(T)
{
        mixin subtemp!(T);
        template subtemp(U)
        {
                void mytemp(T v)
                {
                        writefln(v);
                }
        }
}

void main()
{
        mytemp(3);
}


abc.d(3): template abc.mytemp(T) is not a function template
abc.d(17): template abc.mytemp(T) cannot deduce template function from argument
types (int)


-- 
Sep 17 2007