Home | History | Annotate | Download | only in complex.special
      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<double>
     13 // {
     14 // public:
     15 //     constexpr complex(const complex<float>&);
     16 // };
     17 
     18 #include <complex>
     19 #include <cassert>
     20 
     21 int main()
     22 {
     23     {
     24     const std::complex<float> cd(2.5, 3.5);
     25     std::complex<double> 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<float> cd(2.5, 3.5);
     32     constexpr std::complex<double> cf = cd;
     33     static_assert(cf.real() == cd.real(), "");
     34     static_assert(cf.imag() == cd.imag(), "");
     35     }
     36 #endif
     37 }
     38