Boost logo

Boost :

Subject: Re: [boost] [1.53.0] Beta release candidates 2 now available for testing
From: Pyry Jahkola (pyry.jahkola_at_[hidden])
Date: 2013-01-06 05:53:07


On 2013-01-05 23:06:34 +0000, Marshall Clow said:

>>> This is a bug in libc++; std::numeric_limits<>::max() is not marked as
>>> constexpr.
>>> This has been fixed in the libc++ trunk, and should appear in the next
>>> clang/libc++ release.

I faced this issue when patching the HPX library to compile on OS X a
few weeks ago. FWIW, the trunk version of libc++ *does* use constexpr
in std::numeric_limits. It's mostly the Xcode shipped version that
doesn't offer the support. In the meantime, the following is a good
idea IMO:

>> BTW, which version of libc++ are you using?
>
> The one that ships with Xcode 4.5.2 - the most recent release from Apple.
> I don't believe that libc++ has a version number.

Yes there is such a macro in libc++, the most recent version being:

    #define _LIBCPP_VERSION 1101

(See: http://llvm.org/svn/llvm-project/libcxx/trunk/include/__config)

The version number has been updating somewhat inconsistently but
according to the SVN history, constexpr support should be there since
(_LIBCPP_VERSION >= 1002).

    $ svn log -r153888
    ------------------------------------------------------------------------
    r153888 | hhinnant | 2012-04-02 22:23:15 +0300 (Mon, 02 Apr 2012) | 1 line

    Update <limits> with constexpr support. Patch contributed by
Jonathan Sauer.
    ------------------------------------------------------------------------

    $ svn log -r164700
    ------------------------------------------------------------------------
    r164700 | hhinnant | 2012-09-26 18:38:09 +0300 (Wed, 26 Sep 2012) | 1 line

    Bump _LIBCPP_VERSION to 1002
    ------------------------------------------------------------------------

I'd recommend having:

    #if defined(_LIBCPP_VERSION)
        #if _LIBCPP_VERSION < 1002
            #define BOOST_NO_CXX11_NUMERIC_LIMITS
        #endif
    #endif

-- 
Pyry Jahkola
pyry.jahkola_at_[hidden]
https://twitter.com/pyrtsa

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk