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

Ruben Van Boxem vanboxem.ruben at gmail.com
Sat Jun 18 07:46:51 PDT 2011


2011/6/18 Howard Hinnant <hhinnant at apple.com>:
> 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.

OK, thanks, then I'll refrain from filing a bug.

> The <chrono> that comes with libc++ (http://libcxx.llvm.org/) has not yet been constepxr'd, and so works with clang.

You don't understand how much I'd like to try libc++... too bad it
doesn't work with Windows/MinGW yet :(

>
> Howard
>
>




More information about the cfe-dev mailing list