|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84116 - in trunk: boost/log/utility status
From: andrey.semashev_at_[hidden]
Date: 2013-05-02 15:37:33
Author: andysem
Date: 2013-05-02 15:37:32 EDT (Thu, 02 May 2013)
New Revision: 84116
URL: http://svn.boost.org/trac/boost/changeset/84116
Log:
Added a workaround for MSVC that allows to prevent conversion to void*.
Text files modified:
trunk/boost/log/utility/explicit_operator_bool.hpp | 17 +++++++++++++++++
trunk/status/explicit-failures-markup.xml | 8 --------
2 files changed, 17 insertions(+), 8 deletions(-)
Modified: trunk/boost/log/utility/explicit_operator_bool.hpp
==============================================================================
--- trunk/boost/log/utility/explicit_operator_bool.hpp (original)
+++ trunk/boost/log/utility/explicit_operator_bool.hpp 2013-05-02 15:37:32 EDT (Thu, 02 May 2013)
@@ -47,6 +47,8 @@
namespace aux {
+#if !defined(_MSC_VER)
+
struct unspecified_bool
{
// NOTE TO THE USER: If you see this in error messages then you tried
@@ -57,6 +59,21 @@
};
typedef void (*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
+#else
+
+ // MSVC is too eager to convert pointer to function to void* even when it shouldn't
+ struct unspecified_bool
+ {
+ // NOTE TO THE USER: If you see this in error messages then you tried
+ // to apply an unsupported operator on the object that supports
+ // explicit conversion to bool.
+ struct OPERATORS_NOT_ALLOWED;
+ void true_value(OPERATORS_NOT_ALLOWED*) {}
+ };
+ typedef void (unspecified_bool::*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
+
+#endif
+
} // namespace aux
BOOST_LOG_CLOSE_NAMESPACE // namespace log
Modified: trunk/status/explicit-failures-markup.xml
==============================================================================
--- trunk/status/explicit-failures-markup.xml (original)
+++ trunk/status/explicit-failures-markup.xml 2013-05-02 15:37:32 EDT (Thu, 02 May 2013)
@@ -2564,14 +2564,6 @@
Boost.Filesystem used by Boost.Log does not support Windows Mobile.
</note>
</mark-unusable>
- <mark-expected-failures>
- <test name="util_explicit_operator_bool_conv_pvoid"/>
- <toolset name="msvc-*"/>
- <note author="Andrey Semashev" date="02 May 2013">
- MSVC performs implicit conversion of pointers to members to void*,
- which is against the standard (4.11, [conv.mem]) and is verified by this test.
- </note>
- </mark-expected-failures>
</library>
<!-- logic -->
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