https://bugs.llvm.org/show_bug.cgi?id=37810
Bug ID: 37810
Summary: [CLANG][warnings] With -Wextra the compiler should
emit a warning when enumerator and non-enumerator both
appear in conditional expression
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: konstantin.belocha...@sony.com
CC: llvm-bugs@lists.llvm.org
If extra warnings are enabled ( -Wall is passed as input to clang)
the compiler should warn when a enumerator and a non-enumerator both appear in
a conditional
expression.
Given the following example:
////////////////////////////
enum E { A, B };
int f1(void *p) {
float x=0;
x += (p!=0) ? 2.0: B;
return x;
}
///////////////////////////
$clang test.cpp -Wall -c
// No warnings generated.
$clang test.cpp -Wall -Wextra -c
// No warnings generated.
While
$g++ test.cpp -Wall -c
// No warnings generated.
$g++ test.cpp -Wall -Wextra -c
test.cpp: In function ‘int f1(void*)’:
test.cpp:5: warning: enumeral and non-enumeral type in conditional expression
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs