[libcxx-commits] [PATCH] D114244: [libc++] Avoid potential truncation warnings in std::abs test
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 19 11:22:45 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1b4c0cb3918a: [libc++] Avoid potential truncation warnings in std::abs test (authored by ldionne).
Changed prior to commit:
https://reviews.llvm.org/D114244?vs=388493&id=388576#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114244/new/
https://reviews.llvm.org/D114244
Files:
libcxx/test/std/numerics/c.math/abs.fail.cpp
libcxx/test/std/numerics/c.math/abs.verify.cpp
Index: libcxx/test/std/numerics/c.math/abs.verify.cpp
===================================================================
--- libcxx/test/std/numerics/c.math/abs.verify.cpp
+++ libcxx/test/std/numerics/c.math/abs.verify.cpp
@@ -8,24 +8,19 @@
#include <cmath>
-#include "test_macros.h"
-
-int main(int, char**)
-{
+void f() {
unsigned int ui = -5;
- ui = std::abs(ui); // expected-error {{call to 'abs' is ambiguous}}
+ (void)std::abs(ui); // expected-error {{call to 'abs' is ambiguous}}
unsigned char uc = -5;
- uc = std::abs(uc); // expected-warning {{taking the absolute value of unsigned type 'unsigned char' has no effect}}
+ (void)std::abs(uc); // expected-warning {{taking the absolute value of unsigned type 'unsigned char' has no effect}}
unsigned short us = -5;
- us = std::abs(us); // expected-warning {{taking the absolute value of unsigned type 'unsigned short' has no effect}}
+ (void)std::abs(us); // expected-warning {{taking the absolute value of unsigned type 'unsigned short' has no effect}}
unsigned long ul = -5;
- ul = std::abs(ul); // expected-error {{call to 'abs' is ambiguous}}
+ (void)std::abs(ul); // expected-error {{call to 'abs' is ambiguous}}
unsigned long long ull = -5;
- ull = ::abs(ull); // expected-error {{call to 'abs' is ambiguous}}
-
- return 0;
+ (void)std::abs(ull); // expected-error {{call to 'abs' is ambiguous}}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114244.388576.patch
Type: text/x-patch
Size: 1433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211119/d1e6d7bf/attachment.bin>
More information about the libcxx-commits
mailing list