|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72868 - in sandbox/conversion/libs/conversion_ext: example test
From: vicente.botet_at_[hidden]
Date: 2011-07-03 05:45:43
Author: viboes
Date: 2011-07-03 05:45:38 EDT (Sun, 03 Jul 2011)
New Revision: 72868
URL: http://svn.boost.org/trac/boost/changeset/72868
Log:
Conversion: warning removal
Text files modified:
sandbox/conversion/libs/conversion_ext/example/overload.cpp | 27 +++++++++++++++++++++++++++
sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 | 1 +
sandbox/conversion/libs/conversion_ext/test/builtins.cpp | 8 ++++++++
sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp | 1 +
sandbox/conversion/libs/conversion_ext/test/intrinsec.cpp | 25 ++++++++++++++++++++-----
5 files changed, 57 insertions(+), 5 deletions(-)
Modified: sandbox/conversion/libs/conversion_ext/example/overload.cpp
==============================================================================
--- sandbox/conversion/libs/conversion_ext/example/overload.cpp (original)
+++ sandbox/conversion/libs/conversion_ext/example/overload.cpp 2011-07-03 05:45:38 EDT (Sun, 03 Jul 2011)
@@ -14,6 +14,21 @@
//#include <boost/conversion/std/string.hpp>
#include <string>
#include <iostream>
+
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+#define BOOST_CONVERSION_DCL_DEFAULTS(X) \
+namespace boost \
+{ \
+ template <> struct is_constructible< X > : true_type {}; \
+ template <> struct is_constructible< X, X const& > : true_type {}; \
+ template <> struct is_assignable< X&, X const& > : true_type {}; \
+ template <> struct is_assignable< X, X > : true_type {}; \
+}
+#else
+#define BOOST_CONVERSION_DCL_DEFAULTS(X)
+#endif
+
using namespace boost::conversion;
@@ -36,20 +51,27 @@
struct IntrCvtToInt {
operator int() const {return 0;}
};
+BOOST_CONVERSION_DCL_DEFAULTS(IntrCvtToInt)
struct IntrCvtToString {
operator std::string() const {return "";}
};
+BOOST_CONVERSION_DCL_DEFAULTS(IntrCvtToString)
struct IntrCvtINtAndString {
operator int() const {return 0;}
operator std::string() const {return "";}
};
+BOOST_CONVERSION_DCL_DEFAULTS(IntrCvtINtAndString)
struct ExtrCvtToInt {};
+BOOST_CONVERSION_DCL_DEFAULTS(ExtrCvtToInt)
struct ExtrCvtToString {};
+BOOST_CONVERSION_DCL_DEFAULTS(ExtrCvtToString)
struct ExtrCvtINtAndString {};
+BOOST_CONVERSION_DCL_DEFAULTS(ExtrCvtINtAndString)
struct ExtrExplicitCvtToInt {};
+BOOST_CONVERSION_DCL_DEFAULTS(ExtrExplicitCvtToInt)
namespace boost {
namespace conversion {
@@ -102,6 +124,11 @@
};
//]
+ BOOST_STATIC_ASSERT(( boost::is_extrinsic_convertible< IntrCvtToInt,int >::value));
+ BOOST_STATIC_ASSERT(( !boost::is_extrinsic_convertible< IntrCvtToInt,std::string >::value));
+ BOOST_STATIC_ASSERT(( !boost::is_extrinsic_convertible< IntrCvtToString,int >::value));
+ BOOST_STATIC_ASSERT(( boost::is_extrinsic_convertible< IntrCvtToString,std::string >::value));
+
void impl_intrinsic_test()
{
//[OVERLOAD_CPP_IMPL_INTRINSIC
Modified: sandbox/conversion/libs/conversion_ext/test/Jamfile.v2
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 (original)
+++ sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 2011-07-03 05:45:38 EDT (Sun, 03 Jul 2011)
@@ -39,6 +39,7 @@
<toolset>gcc-mingw-4.5.0:<cxxflags>-fdiagnostics-show-option
<toolset>msvc:<cxxflags>/wd4127
<toolset>msvc:<cxxflags>/wd4244
+ <toolset>msvc:<cxxflags>-D_SCL_SECURE_NO_WARNINGS
;
Modified: sandbox/conversion/libs/conversion_ext/test/builtins.cpp
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/builtins.cpp (original)
+++ sandbox/conversion/libs/conversion_ext/test/builtins.cpp 2011-07-03 05:45:38 EDT (Sun, 03 Jul 2011)
@@ -32,6 +32,10 @@
unsigned short us(s);
unsigned int ui(i);
unsigned long ul(l);
+ (void)uc; // WARNING removal
+ (void)us; // WARNING removal
+ (void)ui; // WARNING removal
+ (void)ul; // WARNING removal
c=boost::conversion::convert_to<char>(c);
s=boost::conversion::convert_to<short>(c);
@@ -80,6 +84,10 @@
unsigned short us(s);
unsigned int ui(i);
unsigned long ul(l);
+ (void)uc; // WARNING removal
+ (void)us; // WARNING removal
+ (void)ui; // WARNING removal
+ (void)ul; // WARNING removal
c=boost::conversion::implicit_convert_to<char>(c);
s=boost::conversion::implicit_convert_to<short>(c);
Modified: sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp (original)
+++ sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp 2011-07-03 05:45:38 EDT (Sun, 03 Jul 2011)
@@ -29,6 +29,7 @@
template <> struct is_constructible< X > : true_type {}; \
template <> struct is_constructible< X, X const& > : true_type {}; \
template <> struct is_assignable< X&, X const& > : true_type {}; \
+ template <> struct is_assignable< X, X > : true_type {}; \
}
#else
#define BOOST_CONVERSION_DCL_DEFAULTS(X)
Modified: sandbox/conversion/libs/conversion_ext/test/intrinsec.cpp
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/intrinsec.cpp (original)
+++ sandbox/conversion/libs/conversion_ext/test/intrinsec.cpp 2011-07-03 05:45:38 EDT (Sun, 03 Jul 2011)
@@ -129,11 +129,14 @@
{
X x;
ICF_X y1(x);
+ (void)y1; // WARNING removal
ICF_X y2 = x;
+ (void)y2; // WARNING removal
}
{
X x;
ICF_X y(convert_to<ICF_X>(x));
+ (void)y; // WARNING removal
}
}
@@ -147,19 +150,29 @@
{
X x;
ECF_X y1(x);
+ (void)y1; // WARNING removal
+
//ECF_X y2=x; // compile fails
- ECF_X y2=ECF_X(x);
+ //(void)y2; // WARNING removal
+ //impl_cnv(x); // fail as x is not implicit convertible to ECF_X.
+
+ ECF_X y3=ECF_X(x);
+ (void)y3; // WARNING removal
}
{
X x;
- //ECF_X y(convert_to<ECF_X>(x)); // compile must fail
BOOST_CONVERSION_CONSTRUCT(ECF_X, y, x); // Maybe a macro !!!
ECF_X y1_1(explicit_convert_to<ECF_X>(x));
- //impl_cnv(mcf(x)); // fail as x is not implicit convertible to ECF_X.
+ (void)y1_1; // WARNING removal
#if defined(BOOST_CONVERSION_MCF_ENABLED)
- ECF_X y1_2(mcf(x)); // should not fail as we are requesting an explicit conversionis ambiguous: ECF_X(X) and there are two possible the constructor from X, but will fail for extrinsic conversion.
+ //ECF_X y1_2(mcf(x)); // should fail as ambiguous: ECF_X(X) and ECF_X(ECF_X&const). fails only with gcc4.3. 0x
+#endif
+
+#if defined(BOOST_CONVERSION_MCF_ENABLED)
+ //impl_cnv(mcf(x)); // fail as x is not implicit convertible to ECF_X.
#endif
- ECF_X y2 = explicit_convert_to<ECF_X>(x);
+ ECF_X y3 = explicit_convert_to<ECF_X>(x);
+ (void)y3; // WARNING removal
}
}
@@ -186,11 +199,13 @@
ECT_X y;
X x1(y);
X x2=X(y);
+ (void)x2; // WARNING removal
}
{
ECT_X y;
X x1(explicit_convert_to<X>(y));
X x2=explicit_convert_to<X>(y);
+ (void)x2; // WARNING removal
}
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk