[C++ PATCH] C++0x static assertions

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Nov 8 20:23:00 GMT 2006

"Doug Gregor" <doug.gregor@gmail.com> writes:

| On 08 Nov 2006 14:25:31 +0100, Gabriel Dos Reis
| <gdr@integrable-solutions.net> wrote:
| > "Doug Gregor" <doug.gregor@gmail.com> writes:
| >
| > | On 07 Nov 2006 23:42:28 +0100, Gabriel Dos Reis
| > | <gdr@integrable-solutions.net> wrote:
| > | > Douglas Gregor <doug.gregor@gmail.com> writes:
| > | > could we simplify the ugliness and do without __static_assert, and
| > | > plain static_assert?
| >
| > sorry, the above should read "use plain static_assert".
| The issue is that with -std=c++98, "static_assert" is an identifier.
| With -std=c++0x, "static_assert" is a keyword [*]. If we want to be
| able to use static assertions in libstdc++ even when the user compiles
| with -std=c++98, we can't use the "static_assert" keyword for them...
| so the patch provides __static_assert as an alias. We do the same
| thing with "typeof" and "__typeof" and "__typeof__" now.
| If we don't care about this case, I'll eliminate the three lines of
| code in the patch that implement this behavior.

Yes, in C++98 and C++03 static_assert is an identifier but, it has
been known for quite some time that it is being proposed as keyword.
This also gives a heads-up about how much real ode is broken.  My
suspiciion is that except for testsuite failures....

| [*] At some point, we should start warning about these cases.

yes, this should be done -- I think Richard G. suggested
-Wc++0x-compat.  That is useful to have anyway.

-- Gaby

More information about the Gcc-patches mailing list