[Issue 684] New: dmd should compile this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 12 23:43:49 PST 2006


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

           Summary: dmd should compile this
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: davidl at 126.com


import std.stdio;
class hello
{
template a(AnotherT,char[] name,T...){
        AnotherT a(M...)(M m){
        AnotherT localchar;
        foreach(a;T)
        {
                writefln(`hello`);
                localchar~=a.mangleof;
        }
        return cast(AnotherT)localchar;
        }
}
}

void main()
{
        char[] b="adf";
        uint i=123;
        char[3] c="Adf";
        auto a=new hello;
        a.a!(typeof(b),"adf")();
}

dmd output:
testvararg2.d(23): Error: function expected before (), not 'a dotexp template
a(
M...)'

Let's see what would happen if it's not in a class
import std.stdio;
template a(AnotherT,char[] name,T...){
        AnotherT a(M...)(M m){
        AnotherT localchar;
        foreach(a;T)
        {
                writefln(`hello`);
                localchar~=a.mangleof;
        }
        return cast(AnotherT)localchar;
        }
}

void main()
{
        char[] b="adf";
        uint i=123;
        char[3] c="Adf";
        writefln(a!(typeof(b),"Adf")());
}

works & compiles as my expectation


-- 



More information about the Digitalmars-d-bugs mailing list