Keywords and language standard

hi all,

I want to test if an identifier is a keyword, just like II->isKeyword(LOpts), where II is IdentifierInfo.
I have enabled -std=c99 and tested the identifier _Static_assert, but the function isKeyword returned true. _Static_assert is a keyword in C11, not C99. I found the _Static_assert is KEY_ALL in clang/Basic/TokenKinds.def.
I want to know if this is intentional and if so why is it like this


I don’t know for certain, but this is most likely intentional. _Static_assert is an implementation-reserved identifier, so it’s a conforming extension in all language modes.


@philnik is exactly right, since _Static_assert is a reserved word, it is a conforming extension to permit it in all language modes. As it is so useful, when it was implemented as an ‘extension’ in the other language modes.

1 Like