Opened 11 years ago

Closed 11 years ago

#36960 closed defect (wontfix)

boost @1.52.0 build error in chrono caused by CONSTEXPR

Reported by: alain.dewagter@… Owned by: adfernandes (Andrew Fernandes)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: boost, chrono Cc:
Port: boost

Description

I updated boost port to to version 1.52.0 (@99457), and now I get this compiling error:

  error: constexpr function never produces a constant expression

in include/boost/chrono/duration.hpp at lines starting with ">>":

    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) ();
        }
    };

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

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

I reverted to version 1.51.0, as it works fine on this version which has this code:

namespace detail {
    template <class T, bool = is_arithmetic<T>::value>
    struct chrono_numeric_limits {
        static T lowest() throw() {return (std::numeric_limits<T>::min)  ();}
    };

    template <class T>
    struct chrono_numeric_limits<T,true> {
        static T lowest() throw() {return (std::numeric_limits<T>::min)  ();}
    };

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

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

    template <>
    struct chrono_numeric_limits<long double,true> {
        static long double lowest() throw()
        {
            return -(std::numeric_limits<long double>::max)();
        }
    };

    template <class T>
    struct numeric_limits : chrono_numeric_limits<typename remove_cv<T>::type>
    {};

}

I am using the latest version for OSX and Xcode:

OS: 10.8.2 (12C60)

Xcode: 4.5.2 (4G2008a)

Please update the port to fix this issue.

Thank you! Alain

Change History (3)

comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: adfernandes@… removed
Owner: changed from macports-tickets@… to adfernandes@…

Do you get this error when compiling the boost port itself (if so please attach the main.log file) or when compiling some other project (what other project)?

1.52.0 is the newest version of boost available at this time so there is no update that we could apply to the port. If there is a bug in boost 1.52.0 you should report the problem to the developers of boost so that they can fix it and release a new version, to which we can then update the port. It looks like upstream bug #7671 might be related.

comment:2 Changed 11 years ago by alain.dewagter@…

I got this error with the project http://code.google.com/p/maidsafe-dht/

I was thinking that the issue was related to how macport configures/builds the lib, but it is probably just a bug in boost - so you can close this bug.

comment:3 Changed 11 years ago by adfernandes (Andrew Fernandes)

Resolution: wontfix
Status: newclosed

Yep, looks like an upstream boost bug for sure.

Note: See TracTickets for help on using tickets.