The following program compiles:
template <typename T> T f(T &a) {abcd;}
int main() {return 0;}
This is because the template body is not compiled until it is instantiated. If it is not used in a compilation unit, it will not be instantiated. Note
that this is a typical latent error. The error could be in the code for years before it shows up as a compile error.
Saturday, December 4, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment