diff --git a/config.htm b/config.htm index daadf429..5c7ec6bc 100644 --- a/config.htm +++ b/config.htm @@ -911,6 +911,62 @@ void g() { return f(); } x; if the compiler requires a return, even when it can never be reached. + + +
+ #include <iostream> + #include <ostream> + #include <typeinfo> + + template <int n> + void f() { std::cout << n << ' '; } + + template <typename T> + void g() { std::cout << typeid(T).name() << ' '; } + + int main() { + f<1>(); + f<2>(); + + g<int>(); + g<double>(); + } ++ incorrectly outputs "2 2 double double " on VC++ 6. + + These macros, to be used in the function parameter list, fix the + problem without effects on the calling syntax. For instance, in + the case above write: +
+ template <int n> + void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... } + + template <typename T> + void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... } ++ + Beware that they can declare (for affected compilers) a dummy + defaulted parameter, so they +