[PATCH] D145388: [ADT][NFC] Use declval to suppress warning for nullptr use.
Yeting Kuo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 6 16:12:49 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG260bae5ba27c: [ADT][NFC] Use declval to suppress warning for nullptr use. (authored by fakepaper56).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145388/new/
https://reviews.llvm.org/D145388
Files:
llvm/unittests/ADT/RangeAdapterTest.cpp
Index: llvm/unittests/ADT/RangeAdapterTest.cpp
===================================================================
--- llvm/unittests/ADT/RangeAdapterTest.cpp
+++ llvm/unittests/ADT/RangeAdapterTest.cpp
@@ -157,14 +157,12 @@
TYPED_TEST(RangeAdapterRValueTest, RangeType) {
static_assert(
- std::is_same<
- decltype(reverse(*static_cast<TypeParam *>(nullptr)).begin()),
- decltype(static_cast<TypeParam *>(nullptr)->rbegin())>::value,
+ std::is_same_v<decltype(reverse(std::declval<TypeParam>()).begin()),
+ decltype(std::declval<TypeParam>().rbegin())>,
"reverse().begin() should have the same type as rbegin()");
static_assert(
- std::is_same<
- decltype(reverse(*static_cast<const TypeParam *>(nullptr)).begin()),
- decltype(static_cast<const TypeParam *>(nullptr)->rbegin())>::value,
+ std::is_same_v<decltype(reverse(std::declval<const TypeParam>()).begin()),
+ decltype(std::declval<const TypeParam>().rbegin())>,
"reverse().begin() should have the same type as rbegin() [const]");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145388.502852.patch
Type: text/x-patch
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230307/c46891f1/attachment.bin>
More information about the llvm-commits
mailing list