|
Boost-Commit : |
From: steven_at_[hidden]
Date: 2007-12-03 17:51:59
Author: steven_watanabe
Date: 2007-12-03 17:51:58 EST (Mon, 03 Dec 2007)
New Revision: 41670
URL: http://svn.boost.org/trac/boost/changeset/41670
Log:
Fixed ICE on msvc 8.0 sp1 (Whew. Thanks to K.R. Walker for tracking it down)
Added:
sandbox/units/libs/units/test/test_dimensionless_ice1.cpp (contents, props changed)
sandbox/units/libs/units/test/test_dimensionless_ice2.cpp (contents, props changed)
Text files modified:
sandbox/units/boost/units/quantity.hpp | 15 +++++++++------
sandbox/units/libs/units/test/Jamfile.v2 | 2 ++
2 files changed, 11 insertions(+), 6 deletions(-)
Modified: sandbox/units/boost/units/quantity.hpp
==============================================================================
--- sandbox/units/boost/units/quantity.hpp (original)
+++ sandbox/units/boost/units/quantity.hpp 2007-12-03 17:51:58 EST (Mon, 03 Dec 2007)
@@ -353,9 +353,10 @@
/// implicit conversion between different unit systems is allowed
template<class System2, class Y2>
- quantity(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System2),Y2>& source,
+ quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
typename boost::enable_if<detail::is_non_narrowing_conversion<Y2, Y>,
- typename detail::disable_if_is_same<System, System2>::type>::type* = 0) :
+ typename detail::disable_if_is_same<System, System2>::type>::type* = 0,
+ typename boost::enable_if<detail::is_dimensionless_system<System2> >::type* = 0) :
val_(source.value())
{
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
@@ -363,9 +364,10 @@
/// implicit conversion between different unit systems is allowed
template<class System2, class Y2>
- explicit quantity(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System2),Y2>& source,
+ explicit quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
typename boost::disable_if<detail::is_non_narrowing_conversion<Y2, Y>,
- typename detail::disable_if_is_same<System, System2>::type>::type* = 0) :
+ typename detail::disable_if_is_same<System, System2>::type>::type* = 0,
+ typename boost::enable_if<detail::is_dimensionless_system<System2> >::type* = 0) :
val_(static_cast<Y>(source.value()))
{
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
@@ -387,8 +389,9 @@
/// conversion between different unit systems is explicit when
/// the units are not equivalent.
template<class System2, class Y2>
- explicit quantity(const quantity<BOOST_UNITS_HETEROGENEOUS_DIMENSIONLESS_UNIT(System2),Y2>& source) :
- val_(conversion_helper<quantity<BOOST_UNITS_HETEROGENEOUS_DIMENSIONLESS_UNIT(System2),Y2>, this_type>::convert(source).value())
+ explicit quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
+ typename boost::disable_if<detail::is_dimensionless_system<System2> >::type* = 0) :
+ val_(conversion_helper<quantity<unit<dimensionless_type, System2>,Y2>, this_type>::convert(source).value())
{
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
}
Modified: sandbox/units/libs/units/test/Jamfile.v2
==============================================================================
--- sandbox/units/libs/units/test/Jamfile.v2 (original)
+++ sandbox/units/libs/units/test/Jamfile.v2 2007-12-03 17:51:58 EST (Mon, 03 Dec 2007)
@@ -18,6 +18,8 @@
:
[ compile test_predicates.cpp : : ]
[ compile test_negative_denominator.cpp : : ]
+ [ compile test_dimensionless_ice1.cpp : : ]
+ [ compile test_dimensionless_ice2.cpp : : ]
[ run test_dimensionless_quantity.cpp : : : : ]
[ run test_implicit_conversion.cpp : : : : ]
[ run test_quantity.cpp : : : : ]
Added: sandbox/units/libs/units/test/test_dimensionless_ice1.cpp
==============================================================================
--- (empty file)
+++ sandbox/units/libs/units/test/test_dimensionless_ice1.cpp 2007-12-03 17:51:58 EST (Mon, 03 Dec 2007)
@@ -0,0 +1,23 @@
+// mcs::units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2007 Matthias Christian Schabel
+// Copyright (C) 2007 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/units/systems/si/base.hpp>
+
+void foo()
+{
+ boost::units::quantity<boost::units::SI::dimensionless> d = boost::units::quantity< boost::units::SI::dimensionless >();
+}
+
+#include <boost/test/test_tools.hpp>
+
+int main()
+{
+ BOOST_CHECK( 1 == 2 );
+}
Added: sandbox/units/libs/units/test/test_dimensionless_ice2.cpp
==============================================================================
--- (empty file)
+++ sandbox/units/libs/units/test/test_dimensionless_ice2.cpp 2007-12-03 17:51:58 EST (Mon, 03 Dec 2007)
@@ -0,0 +1,24 @@
+// mcs::units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2007 Matthias Christian Schabel
+// Copyright (C) 2007 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/units/systems/si/length.hpp>
+#include <boost/units/systems/cgs/length.hpp>
+
+void foo()
+{
+ boost::units::quantity<boost::units::SI::dimensionless> d(1.0 * boost::units::SI::meters / boost::units::CGS::centimeters);
+}
+
+#include <boost/test/test_tools.hpp>
+
+int main()
+{
+ BOOST_CHECK( 1 == 2 );
+}
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