www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1779] New: Compiler crash when deducing more than 2 type args

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

           Summary: Compiler crash when deducing more than 2 type args
           Product: D
           Version: 2.009
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: paul_m_doc hotmail.com


The lack of compile-time reflection for class template arguments leads to the
following cumbersome code:

template Print(Ts ...) { pragma (msg, Ts.stringof); }

template Tuple(Ts ...) { alias Ts Tuple; }

template Decode( T )                                       { alias Tuple!()
Types; }
template Decode( T : TT!(U1),       alias TT, U1 )         { alias Tuple!(U1)
Types; }
template Decode( T : TT!(U1,U2),    alias TT, U1, U2 )     { alias
Tuple!(U1,U2) Types; }
template Decode( T : TT!(U1,U2,U3), alias TT, U1, U2, U3 ) { alias
Tuple!(U1,U2,U3) Types; }
// etc

struct S1(T1) {}
struct S2(T1, T2) {}
struct S3(T1, T2, T3) {}

alias Decode!( bool ).Types SQ0;
alias Decode!( S1!(bool) ).Types SQ1;
alias Decode!( S2!(bool,short) ).Types SQ2;
//alias Decode!( S3!(bool,short,int) ).Types SQ3;  // <-- crashes when
uncommented

mixin Print!(SQ0);
mixin Print!(SQ1);
mixin Print!(SQ2);
//mixin Print!(SQ3); // <-- and uncomment this


The compiler prints the deduced tuples as:

()
(bool)
(bool, short)

but crashes before printing the 3 arg case.

Came across this issue first with ver 2.007 but still present in 2.009


-- 
Jan 10 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1779


bugzilla digitalmars.com changed:

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





Fixed dmd 1.026 and 2.010


-- 
Feb 16 2008