Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73918 - trunk/libs/ratio/test/ratio_arithmetic
From: vicente.botet_at_[hidden]
Date: 2011-08-19 11:40:43


Author: viboes
Date: 2011-08-19 11:40:42 EDT (Fri, 19 Aug 2011)
New Revision: 73918
URL: http://svn.boost.org/trac/boost/changeset/73918

Log:
ratio: fix #5724: 0 + 0 and 0 - 0 lead to a compile time error
Text files modified:
   trunk/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp | 6 ++++++
   trunk/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp | 6 ++++++
   2 files changed, 12 insertions(+), 0 deletions(-)

Modified: trunk/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp
==============================================================================
--- trunk/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp (original)
+++ trunk/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp 2011-08-19 11:40:42 EDT (Fri, 19 Aug 2011)
@@ -20,6 +20,12 @@
 
 void test()
 {
+ {
+ typedef boost::ratio<0> R1;
+ typedef boost::ratio<0> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
+ }
     {
     typedef boost::ratio<1, 1> R1;
     typedef boost::ratio<1, 1> R2;

Modified: trunk/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp
==============================================================================
--- trunk/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp (original)
+++ trunk/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp 2011-08-19 11:40:42 EDT (Fri, 19 Aug 2011)
@@ -21,6 +21,12 @@
 void test()
 {
 
+ {
+ typedef boost::ratio<0> R1;
+ typedef boost::ratio<0> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
+ }
     {
     typedef boost::ratio<1, 1> R1;
     typedef boost::ratio<1, 1> R2;


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