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

           Summary: Nasty bug about template
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: youx...@gmail.com


--- Comment #0 from Hisayuki Mima <youx...@gmail.com> 2012-08-05 16:51:34 JST 
---
I'm really sorry about this ambiguous summary, but I cannot come up with a
suitable summary.
If you come up with a suitable summary of this bug, please change the summary.


struct Tuple(T...){ alias T Types; }

template TempType(T, alias temp){
    pragma(msg, temp.temp!T.Type); // [1]
    static assert(__traits(compiles, temp.temp!T.Type));
    static if(is(temp.temp!T.Type Unused == Result!U, U)){
        alias U TempType;
    }else{
        static assert(false);
    }
}

struct Result(T){}

template seq(T, temps...){
    static if(temps.length == 1){
        alias Tuple!(TempType!(T, temps[0]).Types) seq; // [2]
    }else{
        alias Tuple!(TempType!(T, temps[0]).Types, seq!(T, temps[1..$]).Types)
seq; // [3]
    }
}

template temp1(){
    template temp(T){
        alias Result!(Tuple!()) Type;
        pragma(msg, seq!(T, temp2!(), temp2!()));
    }
}

template temp2(){
    template temp(T){
        alias Result!(Tuple!()) Type;
        pragma(msg, seq!(T, temp1!(), temp2!()));
    }
}

pragma(msg, temp1!().temp!int);


This code doesn't work with dmd 2.060.
And the error messages changes depending on whether line [1] is comment-outed
or not.
If you remove all ".Types" from the lines [2] and [3], the code works well.

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

Reply via email to