Opened 9 years ago

Closed 8 years ago

#9811 closed Bugs (fixed)

boost/boost/chrono/duration.hpp:355:56: error: call to non-constexpr function 'static std::numeric_limits<float>::_Ty std::numeric_limits<float>::max()' /home/zosun/input_service/inputservices-core-service/other/boost/boost/chrono/duration.hpp: In static member function 'static constexpr double boost::chrono::detail::chrono_numeric_limits<double, true>::lowest()':

Reported by: szj087@… Owned by: viboes
Milestone: Boost 1.56.0 Component: chrono
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description (last modified by viboes)

I am using QNX SDB660 GCC 4.7.3 to create QNX C++ project. It is very simple like that.

#include <boost/thread/recursive_mutex.hpp>

int main(int argc, char *argv[]) {
	return EXIT_SUCCESS;
}

It reports the following error.

In file included from boost/chrono/time_point.hpp:33:0,
                 from boost/thread/lock_types.hpp:22,
                 from boost/thread/pthread/recursive_mutex.hpp:13,
                 from boost/thread/recursive_mutex.hpp:16,
                 from /home/test/number/number.cc:1:
boost/chrono/duration.hpp: In static member function 'static constexpr float boost::chrono::detail::chrono_numeric_limits<float, true>::lowest()':
boost/chrono/duration.hpp:355:56: error: call to non-constexpr function 'static std::numeric_limits<float>::_Ty std::numeric_limits<float>::max()'
boost/chrono/duration.hpp: In static member function 'static constexpr double boost::chrono::detail::chrono_numeric_limits<double, true>::lowest()':
boost/chrono/duration.hpp:363:57: error: call to non-constexpr function 'static std::numeric_limits<double>::_Ty std::numeric_limits<double>::max()'
boost/chrono/duration.hpp: In static member function 'static constexpr long double boost::chrono::detail::chrono_numeric_limits<long double, true>::lowest()':
boost/chrono/duration.hpp:371:61: error: call to non-constexpr function 'static std::numeric_limits<long double>::_Ty std::numeric_limits<long double>::max()'

Is it QNX related or general bug for boost?

Thanks/Zongjun

Change History (10)

comment:1 by Steven Watanabe, 9 years ago

Component: Nonechrono
Owner: set to viboes

comment:2 by viboes, 9 years ago

Description: modified (diff)

comment:3 by viboes, 9 years ago

Description: modified (diff)

comment:4 by viboes, 9 years ago

The definition of

    template <>
    struct chrono_numeric_limits<float,true> {
        static BOOST_CHRONO_LIB_CONSTEXPR float lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW
        {
            return -(std::numeric_limits<float>::max) ();
        }
    };

where

#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
#define BOOST_CHRONO_LIB_CONSTEXPR
#elif defined(_LIBCPP_VERSION) &&  !defined(_LIBCPP_CONSTEXPR)
  #define BOOST_CHRONO_LIB_CONSTEXPR
#else
  #define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR
#endif

Please, could you tell me which macro is defined for the library that I can check so that BOOST_CHRONO_LIB_CONSTEXPR is defined as

  #define BOOST_CHRONO_LIB_CONSTEXPR

?

comment:5 by viboes, 9 years ago

An alternative could be to define BOOST_CHRONO_LIB_CONSTEXPR if not already defined

#ifndef BOOST_CHRONO_LIB_CONSTEXPR
#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
#define BOOST_CHRONO_LIB_CONSTEXPR
#elif defined(_LIBCPP_VERSION) &&  !defined(_LIBCPP_CONSTEXPR)
  #define BOOST_CHRONO_LIB_CONSTEXPR
#else
  #define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR
#endif
#endif

Now the user could define BOOST_CHRONO_LIB_CONSTEXPR if its c++ std library doesn't supports constexpr for numeric_limits. What do you think?

comment:7 by viboes, 9 years ago

Milestone: To Be DeterminedBoost 1.56.0

comment:8 by viboes, 8 years ago

Does the possibility to define BOOST_CHRONO_LIB_CONSTEXPR satisfy you?

Last edited 8 years ago by viboes (previous) (diff)

comment:10 by viboes, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.