[PATCH] D133194: rewording note note_constexpr_invalid_cast

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 10 05:34:08 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In D133194#3781271 <https://reviews.llvm.org/D133194#3781271>, @Codesbyusman wrote:

> updated, I am not getting why this is happening but in the .cpp test file without Wvla all is working and is detecting by default as you are saying but when I use vla-warning/note it gives me error that "warning seen but not expected"

It's because we're passing `-pedantic` on all three RUN lines; because the file is a C++ source file, we issue the pedantic "you're using an extension" warning: https://godbolt.org/z/a8nv6dhE5 so the `-Wvla` is redundant after all (sorry for not catching that sooner).



================
Comment at: clang/lib/AST/ExprConstant.cpp:7476-7477
   bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *E) {
-    CCEDiag(E, diag::note_constexpr_invalid_cast) << 0;
+    CCEDiag(E, diag::note_constexpr_invalid_cast)
+        << 0 << Info.Ctx.getLangOpts().CPlusPlus;
     return static_cast<Derived*>(this)->VisitCastExpr(E);
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133194/new/

https://reviews.llvm.org/D133194



More information about the cfe-commits mailing list