[gjs: 7/9] arg: Make GType argument value selection more explicit




commit a1cf3f6330e9f98421c37a536f4acafc53d5a72a
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Aug 4 16:40:36 2020 +0200

    arg: Make GType argument value selection more explicit
    
    Ensure we check the arg member based on the matching type, using
    constexpr if's.

 gi/arg-inl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gi/arg-inl.h b/gi/arg-inl.h
index 7f313769..473f4f98 100644
--- a/gi/arg-inl.h
+++ b/gi/arg-inl.h
@@ -120,9 +120,9 @@ GJS_USE inline decltype(auto) gjs_arg_member<GType, GI_TYPE_TAG_GTYPE>(
     // #else   /* for historic reasons, C++ links against gulong GTypes */
     // typedef gulong                          GType;
     // #endif
-    if constexpr (sizeof(gsize) != sizeof(gulong))
+    if constexpr (std::is_same_v<GType, gsize>)
         return gjs_arg_member(arg, &GIArgument::v_size);
-    else
+    else if constexpr (std::is_same_v<GType, gulong>)
         return gjs_arg_member(arg, &GIArgument::v_ulong);
 }
 


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