#2961 closed Bugs (fixed)
Boost 1.38.0 fails to compile on g++-4.0.2
| Reported by: | Owned by: | John Maddock | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | math |
| Version: | Boost 1.38.0 | Severity: | Showstopper |
| Keywords: | 4.0.2, math, test_is_policy | Cc: |
Description
Boost 1.38.0 fails to compile on g++-4.0.2 on x86 Linux (while -4.0.1 is a tested target). The code compiles on g++-3.4.3.
The offending file is source:/tags/release/Boost_1_38_0/boost/math/policies/policy.hpp . I'm sorry, that I don't have the full error message here, it's at work, and I don't have the specific compiler setup at home.
namespace detail{
template <class A1,
class A2,
class A3,
class A4,
class A5,
class A6,
class A7,
class A8,
class A9,
class A10,
class A11>
char test_is_policy(const policy<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11>*);
double test_is_policy(...);
template <class P>
struct is_policy_imp
{
BOOST_STATIC_CONSTANT(bool, value = (sizeof(test_is_policy(static_cast<P*>(0))) == 1));
};
}
The error says that:
"test_is_policy" undefined at scope , at line BOOST_STATIC_CONSTANT(bool, value = (sizeof(test_is_policy(static_cast<P*>(0))) == 1));
Solution:
Replace sizeof(test_is_policy(static_cast<P*>(0))) with sizeof(boost::math::policy::detail::test_is_policy(static_cast<P*>(0)))
Note: the same fix probably applies to source:/trunk/boost/math/policies/policy.hpp
Change History (4)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
| Milestone: | Boost 1.39.0 → To Be Determined |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Fixed in Trunk, fix will have to wait for 1.40 now for release branch.
Also note that later gcc versions have no such issues.
comment:4 by , 14 years ago
Thanks I know that on later compilers it compiles without an issue. Unfortunately, upgrading the compiler version is problematic.

I'm of course an idiot, the suggested fix is
sizeof(boost::math::policies::detail::test_is_policy(static_cast<P*>(0)))