Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -12102,6 +12102,11 @@ if (Loc.isMacroID()) return; + // Do not diagnose if both LHS and RHS are macros + if (XorLHS.get()->getExprLoc().isMacroID() && + XorRHS.get()->getExprLoc().isMacroID()) + return; + bool Negative = false; bool ExplicitPlus = false; const auto *LHSInt = dyn_cast(XorLHS.get()); Index: clang/test/SemaCXX/warn-xor-as-pow.cpp =================================================================== --- clang/test/SemaCXX/warn-xor-as-pow.cpp +++ clang/test/SemaCXX/warn-xor-as-pow.cpp @@ -65,6 +65,7 @@ res = 2 ^ 0x4; res = 2 ^ 04; + res = TWO ^ TEN; res = 0x2 ^ 10; res = 0X2 ^ 10; res = 02 ^ 10;