Opened 10 years ago

Last modified 10 years ago

#8367 closed Bugs

chrono does not compile with clang from XCode 4.5.2 with -std=c++11 -stdlib=libc++ and -arch armv7 — at Version 1

Reported by: Franz Detro <franz.detro@…> Owned by: viboes
Milestone: Boost 1.54.0 Component: chrono
Version: Boost 1.53.0 Severity: Showstopper
Keywords: Cc:

Description (last modified by viboes)

When trying to compile chrono with the Xcode 4.5.2 clang compiler on MacOS X for iOS with

-std=c++11 -stdlib=libc++ and -arch armv7

one gets compile errors. Compile log attached.

I'm using the following configuration and everything is right.

using clang : 3.2 : /Users/viboes/clang/clang+llvm-3.2-x86_64-apple-darwin11/bin/clang++ ;
using clang : 3.2xl : /Users/viboes/clang/clang+llvm-3.2-x86_64-apple-darwin11/bin/clang++ : <cxxflags>"-std=c++11 -stdlib=libc++" <linkflags>"-std=c++11 -stdlib=libc++" ;

Change History (2)

by Franz Detro <franz.detro@…>, 10 years ago

Attachment: clang_chrono.txt added

comment:1 by viboes, 10 years ago

Description: modified (diff)
Status: newassigned

The error appears when the standard library doesn't uses constexpr for max()

41	./boost/chrono/duration.hpp:353:49: error: constexpr function never produces a constant expression
42	        static BOOST_CHRONO_LIB_CONSTEXPR float lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW
43	                                                ^
44	./boost/chrono/duration.hpp:355:21: note: non-constexpr function 'max' cannot be used in a constant expression
45	            return -(std::numeric_limits<float>::max) ();
46	                    ^

BOOST_CHRONO_LIB_CONSTEXPR is defined as follows

#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
#define BOOST_CHRONO_LIB_CONSTEXPR
#elif defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 1002
  #define BOOST_CHRONO_LIB_CONSTEXPR
#else
  #define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR
#endif

Could you tell me what is the value of BOOST_NO_CXX11_NUMERIC_LIMITS and _LIBCPP_VERSION on the environment you get the error?

Note: See TracTickets for help on using tickets.