[PATCH] D156565: Diagnose use of VLAs in C++ by default
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 28 13:08:41 PDT 2023
aaron.ballman added a comment.
In D156565#4543414 <https://reviews.llvm.org/D156565#4543414>, @jrtc27 wrote:
> Given GCC defines GNU C++ and regards this as a feature (unless you use things like -pedantic to ask for ISO C++), does it make sense to enable this for GNU C++?
I think GCC should enable -Wvla by default in GNU C++ as well, for the same reasons I'm proposing it for Clang. I've filed an issue for it at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110848
> Every deviation from GCC is a point of friction for adopting Clang over GCC.
It is, but one of the selling points of Clang is that we strive to comprehensive diagnostics and that sometimes leads to these deviations with GCC. We don't make much of a distinction between GNU++ and C++ modes in Clang (~10 uses of `GNUMode` in the frontend), but that is an approach I could take should it be necessary. However, I strongly prefer to enable this diagnostic in all C++ modes -- VLA use in C++ is deeply weird and easy to overlook, making it a bug factory: https://github.com/llvm/llvm-project/issues?q=is%3Aissue+is%3Aopen+VLA+C%2B%2B
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156565/new/
https://reviews.llvm.org/D156565
More information about the cfe-commits
mailing list