[Boost-bugs] [Boost C++ Libraries] #5724: "0 + 0" and "0 - 0" lead to a compile time error

Subject: [Boost-bugs] [Boost C++ Libraries] #5724: "0 + 0" and "0 - 0" lead to a compile time error
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-07-20 12:04:56


#5724: "0 + 0" and "0 - 0" lead to a compile time error
-----------------------------------------------+----------------------------
 Reporter: iorate <iorate_stage@…> | Owner:
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
-----------------------------------------------+----------------------------
 The following code causes a compilication error under GCC 4.5, 4.6 and VC
 10.
 {{{
 #define BOOST_RATIO_EXTENSIONS
 #include <boost/ratio.hpp>

 using namespace boost;

 typedef ratio_add<ratio<0>, ratio<0> >::type zero_plus_zero;
 typedef ratio_subtract<ratio<0>, ratio<0> >::type zero_minus_zero;
 }}}
 Error messages (GCC 4.6.0):
 {{{
 In file included from C:/Opt/boost/boost/ratio/ratio.hpp:48:0,
                  from C:/Opt/boost/boost/ratio/include.hpp:11,
                  from C:/Opt/boost/boost/ratio.hpp:12,
                  from test.cpp:2:
 C:/Opt/boost/boost/ratio/detail/overflow_helpers.hpp: In instantiation of
 'boost::ratio_detail::ratio_add<boost::ratio<0ll>, boost::ratio<0ll> >':
 C:/Opt/boost/boost/ratio/ratio.hpp:136:8: instantiated from
 'boost::ratio_add<boost::ratio<0ll>, boost::ratio<0ll> >'
 test.cpp:5:39: instantiated from here
 C:/Opt/boost/boost/ratio/detail/overflow_helpers.hpp:243:18: error: '(0ll
 / 0ll)' is not a constant expression
 C:/Opt/boost/boost/ratio/detail/overflow_helpers.hpp:243:18: note: in
 template argument for type 'long long int'
 test.cpp:5:9: error: 'type' in class 'boost::ratio_add<boost::ratio<0ll>,
 boost::ratio<0ll> >' does not name a type
 In file included from C:/Opt/boost/boost/ratio/ratio.hpp:48:0,
                  from C:/Opt/boost/boost/ratio/include.hpp:11,
                  from C:/Opt/boost/boost/ratio.hpp:12,
                  from test.cpp:2:
 C:/Opt/boost/boost/ratio/detail/overflow_helpers.hpp: In instantiation of
 'boost::ratio_detail::ratio_subtract<boost::ratio<0ll>, boost::ratio<0ll>
>':
 C:/Opt/boost/boost/ratio/ratio.hpp:142:8: instantiated from
 'boost::ratio_subtract<boost::ratio<0ll>, boost::ratio<0ll> >'
 test.cpp:6:44: instantiated from here
 C:/Opt/boost/boost/ratio/detail/overflow_helpers.hpp:269:18: error: '(0ll
 / 0ll)' is not a constant expression
 C:/Opt/boost/boost/ratio/detail/overflow_helpers.hpp:269:18: note: in
 template argument for type 'long long int'
 test.cpp:6:9: error: 'type' in class
 'boost::ratio_subtract<boost::ratio<0ll>, boost::ratio<0ll> >' does not
 name a type

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5724>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC