[clang] [Clang] Fix P2564 handling of variable initializers (PR #89565)
Daniel M. Katz via cfe-commits
cfe-commits at lists.llvm.org
Thu May 16 12:01:39 PDT 2024
katzdm wrote:
@Fznamznon Hmm...my suggested change does seem to break some tests :( But to circle back to your original question, I think it's not totally unexpected - a broader class of variable initializers are now (correctly afaict) evaluated as constant expressions, which could make some warnings marked as "runtime behavior" no longer apply. I agree though that the result is unfortunate - @erichkeane had pushed back on some other warnings similarly getting swallowed during review.
I wonder if we're taking the wrong approach here - we could also leave both of these warnings as "runtime only", and separately try to diagnose during constant evaluation. If that could work, it might make it easier to e.g., only diagnose overflow in a branch of a compile-time conditional if it's actually evaluated (which GCC seems to manage to do).
https://github.com/llvm/llvm-project/pull/89565
More information about the cfe-commits
mailing list