libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

literals1.pass.cpp (956B)


      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 // UNSUPPORTED: c++98, c++03, c++11
     11 // <chrono>
     12 
     13 #include <complex>
     14 #include <type_traits>
     15 #include <cassert>
     16 
     17 int main()
     18 {
     19     using namespace std::literals;
     20 
     21     {
     22     std::complex<long double> c1 = 3.0il;
     23     assert ( c1 == std::complex<long double>(0, 3.0));
     24     auto c2 = 3il;
     25     assert ( c1 == c2 );
     26     }
     27 
     28     {
     29     std::complex<double> c1 = 3.0i;
     30     assert ( c1 == std::complex<double>(0, 3.0));
     31     auto c2 = 3i;
     32     assert ( c1 == c2 );
     33     }
     34 
     35     {
     36     std::complex<float> c1 = 3.0if;
     37     assert ( c1 == std::complex<float>(0, 3.0));
     38     auto c2 = 3if;
     39     assert ( c1 == c2 );
     40     }
     41 }