浏览代码

LibJS: Use AK::NaN<double> in Date::date_value() to fix build error

This was not happening locally for me, neither when building Lagom on
Linux nor with the SerenityOS toolchain...

    error: implicit conversion from ‘float’ to ‘double’ to match other
    result of conditional [-Werror=double-promotion]
Linus Groh 3 年之前
父节点
当前提交
aa2b85c697
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Userland/Libraries/LibJS/Runtime/Date.h

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Date.h

@@ -6,6 +6,7 @@
 
 #pragma once
 
+#include <AK/Math.h>
 #include <LibCore/DateTime.h>
 #include <LibJS/Runtime/Object.h>
 
@@ -78,7 +79,7 @@ public:
     double date_value() const
     {
         return m_is_invalid
-            ? NAN
+            ? AK::NaN<double>
             : static_cast<double>(m_datetime.timestamp() * 1000 + m_milliseconds);
     }