[cfe-dev] static_assert without C++11 and with a message?

Stephen Kelly steveire at gmail.com
Tue Jun 19 00:22:14 PDT 2012


Hi there,

I was looking into libc++, and noticed the implementation of static_assert 
for pre-c++11 compilers.

Inside of the _LIBCPP_HAS_NO_STATIC_ASSERT ifdef, there is a typo (__t 
should be __m I presume?), but even when that is fixed, I can't see how the 
static assert macro could work.

It would expand to 

typedef __static_assert_check<unsigned> "some message";

in both the true and false case. For the false case it fails to compile the 
__static_assert_check<unsigned> already, but for the true case it also fails 
to compile. How should that work?

Thanks,

Steve.





More information about the cfe-dev mailing list