Fixes issue https://github.com/llvm/llvm-project/issues/61943
#include <iostream> int main() { int ai32 = 5; std::cout << true ? 1 : 0; std::cout << "Test" << ai32 ? 1 : 0; int b = ai32 & 1 ? true : false; auto c = true ? "1" : "0"; return 0; }
Before the change
test.cpp:6:23: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses] std::cout << true ? 1 : 0; ~~~~~~~~~~~~~~~~~ ^ test.cpp:6:23: note: place parentheses around the '<<' expression to silence this warning std::cout << true ? 1 : 0; ^ ( ) test.cpp:6:23: note: place parentheses around the '?:' expression to evaluate it first std::cout << true ? 1 : 0; ^ ( ) 1 warning generated.
After the change
test.cpp:6:23: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses] std::cout << true ? 1 : 0; ~~~~~~~~~~~~~~~~~ ^ test.cpp:6:23: note: place parentheses around the '<<' expression to silence this warning std::cout << true ? 1 : 0; ^ ( ) test.cpp:6:23: note: place parentheses around the '?:' expression to evaluate it first std::cout << true ? 1 : 0; ^ ( ) test.cpp:7:33: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses] std::cout << "Test" << ai32 ? 1 : 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ test.cpp:7:33: note: place parentheses around the '<<' expression to silence this warning std::cout << "Test" << ai32 ? 1 : 0; ^ ( ) test.cpp:7:33: note: place parentheses around the '?:' expression to evaluate it first std::cout << "Test" << ai32 ? 1 : 0; ^ ( ) test.cpp:8:22: warning: operator '?:' has lower precedence than '&'; '&' will be evaluated first [-Wbitwise-conditional-parentheses] int b = ai32 & 1 ? true : false; ~~~~~~~~ ^ test.cpp:8:22: note: place parentheses around the '&' expression to silence this warning int b = ai32 & 1 ? true : false; ^ ( ) test.cpp:8:22: note: place parentheses around the '?:' expression to evaluate it first int b = ai32 & 1 ? true : false; ^ ( ) 3 warnings generated.
It looks like a rebase accidentally duplicated this line.