[cfe-dev] static_assert without C++11 and with a message?
hhinnant at apple.com
Tue Jun 19 19:53:17 PDT 2012
On Jun 19, 2012, at 10:45 PM, Richard Smith wrote:
> Hah, of course, the constant expression rules are tighter in C++98 too
> :) Depending on how much you want to emulate C++11 semantics, you
> could either stick with what you have, or enable full folding with the
> __builtin_constant_p(...) ? ... : ... hack.
Yeah. I'm kind of hoping for C++98/03 to just gracefully fade away. A lot of standards effort was put into making C++11 backward API compatibility and hopefully people will just migrate. There's a lot of attempted C++11 emulation of libc++ in C++03 mode. static_assert is the best of it. Variadic templates is the worst. And in other places such as move semantics and <tuple>, no attempt is made at all.
The message is: migrate to -std=c++11 ! It is worth it! :-)
More information about the cfe-dev