]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use __promote_3 for std::hypot [PR121097]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 15 Jul 2025 20:29:33 +0000 (21:29 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 4 Sep 2025 12:31:38 +0000 (13:31 +0100)
The __promoted_t alias is only defined when __cpp_fold_expressions is
defined, which might not be the case for some hypothetical C++17
compilers.

Change the 3-arg std::hypot to just use __gnu_cxx::__promote_3 which is
always available.

libstdc++-v3/ChangeLog:

PR libstdc++/121097
* include/c_global/cmath (hypot): Use __promote_3 instead of
__promoted.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
(cherry picked from commit f4932c59df387a505de69a5a1015a03caa4ccf08)

libstdc++-v3/include/c_global/cmath

index 8b0735a2b1bc3132c36417017353abcfb8954741..5932581ac9f0a73caca80d45caefa921965c20a8 100644 (file)
@@ -3583,10 +3583,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   { return std::__hypot3<long double>(__x, __y, __z); }
 
   template<typename _Tp, typename _Up, typename _Vp>
-    __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>
+    typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
     hypot(_Tp __x, _Up __y, _Vp __z)
     {
-      using __type = __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>;
+      using __type = typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type;
       return std::__hypot3<__type>(__x, __y, __z);
     }