[cfe-dev] Clang gives error for "static_assert" in GCC 4.6 libstdc++ <chrono> header

Howard Hinnant hhinnant at apple.com
Sat Jun 18 07:44:38 PDT 2011


On Jun 18, 2011, at 10:40 AM, Ruben Van Boxem wrote:

> Clang gives an error for a static_assert in GCC 4.6's <chrono> header
> (just build a simple hello world including <thread>):
> 
> M:/Development/mingw64/include/c++/4.6.1/chrono:666:7: error:
> static_assert expression is not an integral constant expression
>      static_assert(system_clock::duration::min()
>      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
> 
> Checking the C++ status page I saw that static_assert should work
> mostly. Is this a problem in the part that works, or is this error
> generated because it doesn't work well yet (in which case, the colors
> on the status page are very misleading.

clang doesn't yet implement constexpr, and therefore system_clock::duration::min() is not something known at compile time.  static_assert only works with compile-time information.  The <chrono> that comes with libc++ (http://libcxx.llvm.org/) has not yet been constepxr'd, and so works with clang.

Howard




More information about the cfe-dev mailing list