forked from boostorg/utility
Workarounds for GCC and Intel/Win32
[SVN r1887]
This commit is contained in:
@@ -125,16 +125,20 @@ namespace test
|
|||||||
template <class Name_, class Value_, class Index_>
|
template <class Name_, class Value_, class Index_>
|
||||||
void operator()(Name_ const& n_, Value_ const& v_, Index_ const& i_) const
|
void operator()(Name_ const& n_, Value_ const& v_, Index_ const& i_) const
|
||||||
{
|
{
|
||||||
/* std::cout << typeid(Name_).name() << "\n";
|
|
||||||
std::cout << typeid(Value_).name() << "\n";
|
// Only VC and its emulators fail this; they seem to have
|
||||||
std::cout << typeid(Index_).name() << "\n";
|
// problems with deducing the constness of string literal
|
||||||
*/
|
// arrays.
|
||||||
// vc7 fails on these assert because of constness mismatch
|
#if defined(_MSC_VER) \
|
||||||
// BOOST_STATIC_ASSERT((boost::is_same<Name,Name_>::value));
|
&& (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) \
|
||||||
|
|| BOOST_WORKAROUND(BOOST_MSVC, < 1310))
|
||||||
|
# else
|
||||||
|
BOOST_STATIC_ASSERT((boost::is_same<Index,Index_>::value));
|
||||||
|
BOOST_STATIC_ASSERT((boost::is_same<Value,Value_>::value));
|
||||||
|
BOOST_STATIC_ASSERT((boost::is_same<Name,Name_>::value));
|
||||||
|
#endif
|
||||||
assert(equal(n, n_));
|
assert(equal(n, n_));
|
||||||
// BOOST_STATIC_ASSERT((boost::is_same<Value,Value_>::value));
|
|
||||||
assert(equal(v, v_));
|
assert(equal(v, v_));
|
||||||
// BOOST_STATIC_ASSERT((boost::is_same<Index,Index_>::value));
|
|
||||||
assert(equal(i, i_));
|
assert(equal(i, i_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +155,15 @@ namespace test
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GCC2 has a problem with char (&)[] deduction, so we'll cast string
|
||||||
|
// literals there.
|
||||||
|
#undef S
|
||||||
|
#if BOOST_WORKAROUND(__GNUC__, == 2)
|
||||||
|
# define S(s) (char const*)s
|
||||||
|
#else
|
||||||
|
# define S(s) s
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
using test::f;
|
using test::f;
|
||||||
@@ -160,13 +173,14 @@ int main()
|
|||||||
using test::tester;
|
using test::tester;
|
||||||
|
|
||||||
f(
|
f(
|
||||||
test::values("foo", "bar", "baz")
|
test::values(S("foo"), S("bar"), S("baz"))
|
||||||
, "foo", "bar", "baz"
|
, S("foo"), S("bar"), S("baz")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
int x = 56;
|
||||||
f(
|
f(
|
||||||
test::values("foo", 666.222, 56)
|
test::values("foo", 666.222, 56)
|
||||||
, index = boost::cref(56), name = "foo"
|
, index = boost::ref(x), name = "foo"
|
||||||
);
|
);
|
||||||
|
|
||||||
//f(index = 56, name = 55); // won't compile
|
//f(index = 56, name = 55); // won't compile
|
||||||
|
Reference in New Issue
Block a user