diff --git a/libstdc++-v3/include/ext/type_traits.h b/libstdc++-v3/include/ext/type_traits.h index 065edb4e9a5..fed78d3a527 100644 --- a/libstdc++-v3/include/ext/type_traits.h +++ b/libstdc++-v3/include/ext/type_traits.h @@ -189,9 +189,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typedef float __type; }; #if __cpp_fold_expressions + template using __promoted_t = decltype((typename __promote<_Tp>::__type(0) + ...)); -#endif + + // Deducing the promoted type is done by __promoted_t<_Tp...>, + // then __promote is used to provide the nested __type member. + template + using __promote_2 = __promote<__promoted_t<_Tp, _Up>>; + + template + using __promote_3 = __promote<__promoted_t<_Tp, _Up, _Vp>>; + + template + using __promote_4 = __promote<__promoted_t<_Tp, _Up, _Vp, _Wp>>; + +#else template::__type, @@ -219,6 +232,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type; }; +#endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index c2f6421e0b7..a5b4406dd68 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1557,35 +1557,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // See ext/type_traits.h for the primary template. - template - struct __promote_2, _Up> - { - public: - typedef std::complex::__type> __type; - }; - - template - struct __promote_2<_Tp, std::complex<_Up> > - { - public: - typedef std::complex::__type> __type; - }; - - template - struct __promote_2, std::complex<_Up> > - { - public: - typedef std::complex::__type> __type; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - #if __cplusplus >= 201103L namespace std _GLIBCXX_VISIBILITY(default)