[llvm] 5b19463 - [Support] Use std::is_convertible_v (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 11:52:10 PST 2022


Author: Kazu Hirata
Date: 2022-11-20T11:52:04-08:00
New Revision: 5b19463f117274a7af69ae04d005d254b743220c

URL: https://github.com/llvm/llvm-project/commit/5b19463f117274a7af69ae04d005d254b743220c
DIFF: https://github.com/llvm/llvm-project/commit/5b19463f117274a7af69ae04d005d254b743220c.diff

LOG: [Support] Use std::is_convertible_v (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/Support/Error.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index 0282f18675c24..04c12cb8f2dc4 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -508,7 +508,7 @@ template <class T> class [[nodiscard]] Expected {
   /// must be convertible to T.
   template <typename OtherT>
   Expected(OtherT &&Val,
-           std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
+           std::enable_if_t<std::is_convertible_v<OtherT, T>> * = nullptr)
       : HasError(false)
 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
         // Expected is unchecked upon construction in Debug builds.
@@ -525,9 +525,8 @@ template <class T> class [[nodiscard]] Expected {
   /// Move construct an Expected<T> value from an Expected<OtherT>, where OtherT
   /// must be convertible to T.
   template <class OtherT>
-  Expected(
-      Expected<OtherT> &&Other,
-      std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr) {
+  Expected(Expected<OtherT> &&Other,
+           std::enable_if_t<std::is_convertible_v<OtherT, T>> * = nullptr) {
     moveConstruct(std::move(Other));
   }
 
@@ -536,7 +535,7 @@ template <class T> class [[nodiscard]] Expected {
   template <class OtherT>
   explicit Expected(
       Expected<OtherT> &&Other,
-      std::enable_if_t<!std::is_convertible<OtherT, T>::value> * = nullptr) {
+      std::enable_if_t<!std::is_convertible_v<OtherT, T>> * = nullptr) {
     moveConstruct(std::move(Other));
   }
 


        


More information about the llvm-commits mailing list