Summary: Nasty bug about template
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Hisayuki Mima <> 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;
        static assert(false);

struct Result(T){}

template seq(T, temps...){
    static if(temps.length == 1){
        alias Tuple!(TempType!(T, temps[0]).Types) seq; // [2]
        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:
------- You are receiving this mail because: -------

Reply via email to