Closed
Description
Bugzilla Link | 37679 |
Version | trunk |
OS | Linux |
Extended Description
$cat /tmp/test.c
enum ENUM {
ENUM_A,
ENUM_B,
};
enum ENUM foo() {
int x;
enum ENUM e;
e = x; // should warn
x = e; // no warning
return x; // should warn
}
enum ENUM bar() {
return ENUM_A; // no warning
}
gcc warns here when using -Wc++-compat
.
$gcc -Wc++-compat /tmp/test.c -c
/tmp/test.c: In function ‘foo’:
/tmp/test.c:10:4: warning: enum conversion in assignment is invalid in C++ [-Wc++-compat]
e = x; // should warn
^
/tmp/test.c:12:9: warning: enum conversion in return is invalid in C++ [-Wc++-compat]
return x; // should warn
^
clang does not warn, but should.