summaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2017-11-04 20:27:47 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2017-11-04 20:27:47 +0000
commita54d18761bea291cfe7735f73d4b45ff23b7a835 (patch)
treefe4796fb13267cbcca74414e9b5f84299507405f /test/Sema
parent0576e32faa24ba1ad257be2a3bd32e82762bc243 (diff)
downloadclang-a54d18761bea291cfe7735f73d4b45ff23b7a835.tar.gz
[Sema] Document+test the -Wsign-conversion change for enums in C code [NFC]
Basically a regression after r316268. However the diagnostic is correct, but the test coverage is bad. So just like rL316500, introduce yet more tests, and adjust the release notes. See https://bugs.llvm.org/show_bug.cgi?id=35200 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/enum-sign-conversion.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Sema/enum-sign-conversion.c b/test/Sema/enum-sign-conversion.c
new file mode 100644
index 0000000000..518fc670d3
--- /dev/null
+++ b/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
+}