[clang] [Clang] Fix warning for non std functions with name `infinity` (PR #123417)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 20 17:08:18 PST 2025


================
@@ -48,24 +48,49 @@ namespace std __attribute__((__visibility__("default"))) {
   isnan(double __x);
   bool
   isnan(long double __x);
-bool
+  bool
   isfinite(float __x);
   bool
   isfinite(double __x);
   bool
   isfinte(long double __x);
- bool
+  bool
   isunordered(float __x, float __y);
   bool
   isunordered(double __x, double __y);
   bool
   isunordered(long double __x, long double __y);
+
+template <class _Ty>
+class numeric_limits {
+public:
+    [[nodiscard]] static constexpr _Ty infinity() noexcept {
+        return _Ty();
+    }
+};
+
 } // namespace )
 }
----------------
shafik wrote:

we should annotate the std namespace as well `// std`

https://github.com/llvm/llvm-project/pull/123417


More information about the cfe-commits mailing list