1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <complex> 11 12 // template<> class complex<float> 13 // { 14 // public: 15 // explicit constexpr complex(const complex<double>&); 16 // }; 17 18 #include <complex> 19 #include <cassert> 20 main()21int main() 22 { 23 { 24 const std::complex<double> cd(2.5, 3.5); 25 std::complex<float> cf(cd); 26 assert(cf.real() == cd.real()); 27 assert(cf.imag() == cd.imag()); 28 } 29 #ifndef _LIBCPP_HAS_NO_CONSTEXPR 30 { 31 constexpr std::complex<double> cd(2.5, 3.5); 32 constexpr std::complex<float> cf(cd); 33 static_assert(cf.real() == cd.real(), ""); 34 static_assert(cf.imag() == cd.imag(), ""); 35 } 36 #endif 37 } 38