Define a fallback implementation of the __promoted_t alias for hypothetical C++17 compilers which don't define __cpp_fold_expressions. Without this, <cmath> can't be compiled by such compilers, because the 3-arg form of std::hypot uses the alias.
libstdc++-v3/ChangeLog: PR libstdc++/121097 * include/ext/type_traits.h (__promoted_t): Define fallback implementation for the 3-arg case that std::hypot uses. --- I tested this by bodging the header so that this definition is used unconditionally, and it seemed to work. libstdc++-v3/include/ext/type_traits.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libstdc++-v3/include/ext/type_traits.h b/libstdc++-v3/include/ext/type_traits.h index 061555231468..ca5bc4e0d23e 100644 --- a/libstdc++-v3/include/ext/type_traits.h +++ b/libstdc++-v3/include/ext/type_traits.h @@ -269,6 +269,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type; }; + +#ifdef __glibcxx_hypot // C++ >= 17 && HOSTED + // __promoted_t is needed by the 3-arg std::hypot so define this in case + // any C++17 compiler doesn't define __cpp_fold_expressions (PR 121097). + template<typename _Tp1, typename _Tp2, typename _Tp3> + using __promoted_t = typename __promote_3<_Tp1, _Tp2, _Tp3>::__type; +#endif + #endif _GLIBCXX_END_NAMESPACE_VERSION -- 2.50.1