[vte] libc: glue: Make FD's operator bool() explicit



commit fc0fb8adc246d146de8869da5be334bdc44000aa
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sun May 10 21:57:01 2020 +0200

    libc: glue: Make FD's operator bool() explicit
    
    This prevents an accidental implicit conversion from FD to
    int with value 0 or 1 instead of using get().

 src/libc-glue.hh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/libc-glue.hh b/src/libc-glue.hh
index 218ebf22..e42ebe16 100644
--- a/src/libc-glue.hh
+++ b/src/libc-glue.hh
@@ -69,7 +69,7 @@ public:
                 return *this;
         }
 
-        constexpr operator bool() const noexcept { return m_fd != -1; }
+        explicit constexpr operator bool() const noexcept { return m_fd != -1; }
 
         constexpr int get() const noexcept { return m_fd; }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]