summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/docs/ReleaseNotes.rst3
-rw-r--r--clang/test/Sema/enum-sign-conversion.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 4c8099121ef..8699812496a 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -82,7 +82,8 @@ Improvements to Clang's diagnostics
tautological comparisons between integer variable of the type ``T`` and the
largest/smallest possible integer constant of that same type.
-- For C code, ``-Wsign-compare``, ``-Wtautological-constant-compare`` and
+- For C code, ``-Wsign-compare``, ``-Wsign-conversion``,
+ ``-Wtautological-constant-compare`` and
``-Wtautological-constant-out-of-range-compare`` were adjusted to use the
underlying datatype of ``enum``.
diff --git a/clang/test/Sema/enum-sign-conversion.c b/clang/test/Sema/enum-sign-conversion.c
new file mode 100644
index 00000000000..518fc670d31
--- /dev/null
+++ b/clang/test/Sema/enum-sign-conversion.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -verify -DUNSIGNED -Wsign-conversion %s
+// RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -verify -Wsign-conversion %s
+
+// PR35200
+enum X { A,B,C};
+int f(enum X x) {
+#ifdef UNSIGNED
+ return x; // expected-warning {{implicit conversion changes signedness: 'enum X' to 'int'}}
+#else
+ // expected-no-diagnostics
+ return x;
+#endif
+}
OpenPOWER on IntegriCloud