Anyone know what's going on here? (variable with an instantiated template as a type shows up as void when instantiating another template)

Gareth Charnock gareth at oerc.ox.ac.uk
Fri Apr 23 06:25:35 PDT 2010


Is this a bug, or am I being dense? I've tried it this on 2.036,2.042 
and 2.043 and on each the compiler produces errors. Searched bugzilla 
for "template and instantiated" and "template and instantiate"

struct A(uint N)  {
}
void unary_op(uint N)(A!(N)) {
}
void main() {
     A!(3) a3;

     pragma(msg,typeof(a3)); //prints A!(3), so a3 is not void, dammit

     unary_op!3(A);// Error: cannot implicitly convert expression
                   // (A(uint N)) of type void to A!(N)
     unary_op(A);  // Error: template template.unary_op(uint N) does not 

                   // match any function template declaration
                   // Error: template template.unary_op(uint N) cannot
                   // deduce template function from argument types
                   // !()(void)   <== what?
}



More information about the Digitalmars-d mailing list