[PATCH] D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 06:17:08 PDT 2023


aaron.ballman added a comment.

In general, I think this is incremental progress on the diagnostic behavior. However, it's clear that there is room for interpretation on what is or is not a false positive diagnostic for this, so we should pay close attention to user feedback during the 17.x release cycle. If it seems we're getting significant push back, we may need to come back and rethink.

Specifically, I think we've improved the situation for code like this:

  // `p` is a pointer, `x` is an `int`, and `b` is a `bool`
  p + x ? 1 : 2; // previously didn't warn, now warns
  p + b ? 1 : 2; // always warned

Does anyone feel we should not move forward with accepting the patch in its current form?



================
Comment at: clang/docs/ReleaseNotes.rst:374-375
   (`#62305 <https://github.com/llvm/llvm-project/issues/62305>`_)
+  (`#62305 <https://github.com/llvm/llvm-project/issues/62305>`_)
+- Print diagnostic warning about precedence when integer expression is used
+  without parentheses in an conditional operator expression
----------------
It looks like a rebase accidentally duplicated this line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147844



More information about the cfe-commits mailing list