Alias parameters for templates does not accept built-in types
Deokjae Lee
asitdepends at gmail.com
Fri Aug 13 21:03:15 PDT 2010
import std.stdio;
template T(alias X) {
}
void main() {
writeln(typeid(typeof(T!int)));
}
dmd 2.048 on linux produces an error for the above code.
Error: template instance T!(int) does not match template declaration T
(alias X)
Built-in primitive types cannot be used as template alias parameters.
User-defined types like structs or classes work well. I think this is a
bug and reported it.
http://d.puremagic.com/issues/show_bug.cgi?id=4639
However, I got a reply that the behaviour is intended.
I think the limitation that the built-in types are not accepted as alias
parameters for templates is not beautiful :(
That's a kind of lack of symmetry and practice :)
I'd like to know the reason of such a limitation.
More information about the Digitalmars-d
mailing list