[gjs: 15/18] tests: Remove constexpr from get_random_number




commit e5aedf5919da056331d9c091e903cde53a5ec022
Author: Philip Chimento <philip chimento gmail com>
Date:   Wed Sep 30 18:25:31 2020 -0700

    tests: Remove constexpr from get_random_number
    
    GCC accepts this, but when compiling with Clang we get an error that the
    random number generator cannot be instantiated in a constant expression.
    That makes sense.

 test/gjs-tests.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 217f7d00..6b89bc35 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -12,6 +12,7 @@
 #include <string>  // for u16string, u32string
 #include <type_traits>
 
+#include <girepository.h>
 #include <glib-object.h>
 #include <glib.h>
 #include <glib/gstdio.h>  // for g_unlink
@@ -46,7 +47,7 @@ void g_assertion_message(const char*, const char*, int, const char*,
 static unsigned cpp_random_seed = 0;
 
 template <typename T>
-constexpr T get_random_number() {
+T get_random_number() {
     std::mt19937_64 gen(cpp_random_seed);
 
     if constexpr (std::is_same_v<T, bool>) {


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