
2007/10/11, John Maddock <john@johnmaddock.co.uk>:
Simon Atanasyan wrote:
The gcc results on that platform are pretty good, so it seems a shame not to support Sun as well, anyone have ideas?
Probably this is a bug in Sun C++. I will take a look on it.
Thanks Simon, if there's a workaround possible for the existing Sun releases that would be great.
Good news - the latest version of Sun C++ works good. This version of the compiler even does not need "Sun related" workaround in the boost/math/concepts/real_concept.hpp (lines 334-338). % CC -V CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25 Bad news - all other version of Sun C++ have a bug. Compiler cannot deduce a type of template parameter for the template specialization based on function return type. Here is test case for this bug: % cat test.cc template <class T> T f() { return T(); } template <> float f() { return 1.0; } int main() { f<float>(); } % CC -c test.cc "test.cc", line 9: Error: Could not find a match for f<T>(). "test.cc", line 15: Error: Could not find a match for f<T>() needed in main(). 2 Error(s) detected. A possible workaround is to add unused argument that helps compiler to handle template specialization: Following code works good: template <class T> T f(T* = 0) { return T(); } template <> float f(float*) { return 1.0; } int main() { f<float>(); } -- Simon Atanasyan