Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:27:55+00:00 2026-06-17T11:27:55+00:00

When trying to compile this one line with clang + libc++ (C++11 mode): #include

  • 0

When trying to compile this one line with clang + libc++ (C++11 mode):

#include <boost/thread.hpp>

clang emits the following errors:

In file included from test.cpp:1:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread.hpp:13:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/thread.hpp:17:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/pthread/thread_data.hpp:11:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/locks.hpp:18:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/chrono/time_point.hpp:33:
/Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:353:49: error: 
  constexpr function never produces a constant expression
    static BOOST_CHRONO_LIB_CONSTEXPR float lowest() ...
                        ^
/Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:355:21: note: 
  non-constexpr function 'max' cannot be used in a constant expression
    return -(std::numeric_limits::max) ();
        ^
/usr/bin/../lib/c++/v1/limits:443:43: note: declared here
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return ...
                      ^
In file included from test.cpp:1:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread.hpp:13:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/thread.hpp:17:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/pthread/thread_data.hpp:11:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/locks.hpp:18:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/chrono/time_point.hpp:33:
/Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:361:50: error: 
  constexpr function never produces a constant expression
    static BOOST_CHRONO_LIB_CONSTEXPR double lowest() ...
                         ^
/Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:363:21: note: 
  non-constexpr function 'max' cannot be used in a constant expression
    return -(std::numeric_limits::max) ();
        ^
/usr/bin/../lib/c++/v1/limits:443:43: note: declared here
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return ...
                      ^
In file included from test.cpp:1:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread.hpp:13:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/thread.hpp:17:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/pthread/thread_data.hpp:11:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/locks.hpp:18:
In file included from /Users/yongwei/Programming/boost_1_52_0/boost/chrono/time_point.hpp:33:
/Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:369:55: error: 
  constexpr function never produces a constant expression
    static BOOST_CHRONO_LIB_CONSTEXPR long double lowest() ...
                          ^
/Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:371:21: note: 
  non-constexpr function 'max' cannot be used in a constant expression
    return -(std::numeric_limits::max)();
        ^
/usr/bin/../lib/c++/v1/limits:443:43: note: declared here
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return ...
                      ^
3 errors generated.

It looks to me this is a bug in libc++, because C++11 does require these functions to be constexpr.

Anyone encountered the same problem and can you concur? Do you know about any fixes?

My clang version is:

Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:27:56+00:00Added an answer on June 17, 2026 at 11:27 am

    With Marx’s hint, I found a workaround. Defining BOOST_NO_CXX11_NUMERIC_LIMITS helps in this case. So it does seem to be an incompleteness of libc++.

    According to Howard Hinnant, it is a bug of libc++, and is already fixed on the trunk. However, no info yet when Apple can release the fix into Xcode. I will mark the question answered for now.

    EDIT: The issue is fixed in Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn). My current Xcode version is 4.6.3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to compile a one-off script, an autogenerated C# program. This program
When trying to compile this code: #include <iostream> #include <vector> using namespace std; class
Having this errors when trying to compile/run my app using Maven. I've succeeded to
I always get this error when trying to compile my file with Boost::GIL PNG
I'm trying to compile this code (the last one): http://www.aforgenet.com/framework/features/blobs_processing.html but it throws: Use
I'm trying to compile an object code with a reference to one lib. This
I trying to compile this code: Int64 itag = BitConverter.ToInt64(temp, 0); itag &= 0xFFFFFFFFFFFFFC00;
I'm trying to compile this function from Learn You a Haskell for Great Good
I'm trying to compile this simple program to start learning how to use timers:
When I'm trying to compile this code with gcc version 4.6.3 on linux with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.