[PATCH] D63423: [Diagnostics] Diagnose misused xor as pow

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 15:45:38 PDT 2019


xbolva00 marked an inline comment as done.
xbolva00 added inline comments.


================
Comment at: test/SemaCXX/warn-xor-as-pow.cpp:13
+    res = a ^ b;
+    res = 2 ^ 0;
+    res = 2 ^ 1; // expected-warning {{result of '2 ^ 1' is 3, maybe you mean '1<<1' (2)?}}
----------------
jfb wrote:
> `2 ^ 0` seems like it would be a bug too?
Small question..

Instead of 1<<0 for this case, I emit fixit "1", seems ok for you?


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

https://reviews.llvm.org/D63423





More information about the cfe-commits mailing list