Ensures an -Wenum-conversion warning happens when one of the enums is
signed and the other is unsigned. Also adds a test file to verify these
warnings.
This warning would not happen since the -Wsign-conversion would make a
diagnostic then return, never allowing the -Wenum-conversion checks.
For example:
C enum PE { P = -1 }; enum NE { N }; enum NE conv(enum PE E) { return E; }
Before this would only create a diagnostic with -Wsign-conversion and never on
-Wenum-conversion. Now it will create a diagnostic for both -Wsign-conversion
and -Wenum-conversion.
I could change it to just warn on -Wenum-conversion as that was what I initially
did. Seeing PR35200 (or GitHub Issue 316268), I let both diagnostics check so that
the sign conversion could generate a warning.
This was tested with check-clang and all tests passed along with the new test
file.
I don't think this change is correct -- we *want* to silence the conversion warnings in this case. GCC behaves that way as well: https://godbolt.org/z/oona5Mr5T