www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 684] New: dmd should compile this

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: davidl 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


-- 
Dec 12 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=684


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed DMD 0.178


-- 
Dec 27 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=684






Added to DStress as
http://dstress.kuehne.cn/run/t/tuple_11_A.d
http://dstress.kuehne.cn/run/t/tuple_11_B.d
http://dstress.kuehne.cn/run/t/tuple_11_C.d
http://dstress.kuehne.cn/run/t/tuple_11_D.d
http://dstress.kuehne.cn/run/t/tuple_11_E.d
http://dstress.kuehne.cn/run/t/tuple_11_F.d
http://dstress.kuehne.cn/run/t/tuple_11_G.d
http://dstress.kuehne.cn/run/t/tuple_11_H.d


-- 
Dec 30 2006