
This would probably be OK, since GCC has the native typeof support. However, when I use the native support, I run into a different problem
Arkadiy Vertleyb writes: that
can be illustrated by the following code:
template<class T, class U> typeof(T() + U()) sum(const T& t, const U& u) { return t + u; }
main() { sum(5, 3.14); // this is line 9 return 0; }
The compile of this code fails with following message:
a.cpp:9: internal compiler error: in write_type, at cp/mangle.c:1555
The following compiles for me (GCC 3.3.3 mingw special): template<class T, class U> struct typeof_ { typedef typeof(T() + U()) type; }; template<class T, class U> typename typeof_<T,U>::type sum(const T& t, const U& u) { return t + u; } int main() { sum(5, 3.14); // this is line 9 return 0; } -- Aleksey Gurtovoy MetaCommunications Engineering