-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"static assertion expression is not an integral constant expression" when compiling glib with clang 15 #57687
Comments
The |
@llvm/issue-subscribers-clang-frontend |
The first operand of
In |
Sounds like not a bug, closing as such. |
@msebor This is true for C11, but you are compiling with |
Does it mean Clang team doesn't want to support GNU extensions when compiling in "C99 with GNU extensions" mode? |
GCC documents its extensions in the C Extensions section of the manual, and Clang in the Differences between various standard modes. As far as I can see, neither discusses this extension. In GCC's case it might be an omission worth fixing, or it might intentionally be undocumented to keep users from relying on it. In Clang's, I'd take that to mean that it's not meant to be supported. No GCC-compatible compiler matches GCC behavior in every respect, nor can it realistically be expected to. But in this case it would seem reasonable to request it in order to support the |
Thank you for exploring this. You are right, I couldn't find |
To be clear, the extension I was referring to is treating equality expressions involving string literals as constant integer expressions. The first argument to That said, since Clang treats the same expression as an integer constant is most other contexts (see the test case below), I think the fact that it rejects it in
|
Got it. Thank you for very interesting information, and thank you for reopening the bug. |
…t (PR llvm#57687) Automated commit created by applying diff 461610 Phabricator-ID: PHID-HMBT-5xgffhiglu2gf7cydmvf Review-ID: D134311
Since I butted in here I feel like I should give it a shot and fix it: my hacky patch is in D134311. |
It's worth noting that C2x has updated the standard in this area: WG14 N2713 was adopted for C2x and clarifies: "An implementation may accept other forms of constant expressions, however, they are not an integer constant expression." |
…t (PR llvm#57687) Automated commit created by applying diff 463607 Phabricator-ID: PHID-HMBT-d4fisnxwj6yzrt6mkizk Review-ID: D134311
…t (PR #57687) Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D134311
Should be fixed by a181de4 |
When compiling glib (https://gitlab.gnome.org/GNOME/glib), Clang 15 issues an error "static assertion expression is not an integral constant expression".
Configuration step:
meson --buildtype=release . ../glib
Error message:
Expressions like
0 == 0
and7 == 7
are integer constant expressions. I am not sure what Clang doesn't like. Another strange thing is_Static_assert
is technically from C11, but as illustrated by the provided error message, glib passesstd=gnu99
.The text was updated successfully, but these errors were encountered: