================
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -verify -Wimplicit-int-conversion 
+// RUN: %clang_cc1 %s -verify -Wimplicit-int-conversion 
-Wno-implicit-int-conversion-on-negation -DNO_DIAG
+
+#ifdef NO_DIAG
+unsigned char test_no_diag(unsigned char x) {
+    return -x; // expected-no-diagnostics
+}
+#else
+unsigned char test_diag(unsigned char x) {
+    return -x; // expected-warning {{implicit conversion loses integer 
precision: 'int' to 'unsigned char' on negation}}
+}
+#endif
----------------
YutongZhuu wrote:

I wasn't able to get this to work, if you are worried about code duplication, 
is the current version better?

https://github.com/llvm/llvm-project/pull/139429
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to