[PATCH] D52137: Added warning for unary minus used with unsigned type

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 15 11:18:45 PDT 2018


xbolva00 added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:12651
+      if (Opc == UO_Minus && resultType->isUnsignedIntegerType())
+        return ExprError(Diag(OpLoc, diag::err_unsignedtypecheck_unary_minus)
+                         << resultType << Input.get()->getSourceRange());
----------------
lebedev.ri wrote:
> Why is this an error?
Ok, I will switch to warning.


https://reviews.llvm.org/D52137





More information about the cfe-commits mailing list