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

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 09:36:23 PDT 2019


jfb added a comment.

I think you want to avoid warning inside macros as well, say:

  #define AWESOME(x, y) ({ blah blah blah; x ^ y; blah })
  
  AWESOME(2, 10); // probably not a bug



================
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)?}}
----------------
`2 ^ 0` seems like it would be a bug too?


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

https://reviews.llvm.org/D63423





More information about the cfe-commits mailing list