Issue 129429
Summary Bogus new error on Wparentheses
Labels
Assignees
Reporter dcb314
    For this C++ code:

extern void g( int);

void f( int a, int b, int c)
{
	if (a <= b <= c)
	{
		g( a);
	}
}

given to a couple of recent builds of clang, does this:

Alphasrc $ /home/dcb40b/llvm/results.20250221/bin/clang++ -c -g -O2 -Wall mar2b.cc
mar2b.cc:6:13: warning: comparisons like 'X<=Y<=Z' don't have their mathematical meaning [-Wparentheses]
    6 |         if (a <= b <= c)
 |                    ^
1 warning generated.
Alphasrc $ /home/dcb40b/llvm/results.20250223/bin/clang++ -c -g -O2 -Wall mar2b.cc
mar2b.cc:6:13: error: comparisons like 'X<=Y<=Z' don't have their mathematical meaning [-Wparentheses]
    6 |         if (a <= b <= c)
 |                    ^
1 error generated.
Alphasrc $ 

I think it is an error to error on this code and a warning is fine. 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to