]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/26_numerics/complex/comparison_operators/more_constexpr.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 26_numerics / complex / comparison_operators / more_constexpr.cc
CommitLineData
23df31a7 1// { dg-options "-std=gnu++2a" }
2// { dg-do compile { target c++2a } }
3
fbd26352 4// Copyright (C) 2018-2019 Free Software Foundation, Inc.
23df31a7 5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <complex>
22#include <testsuite_common_types.h>
23
24template<bool ok>
25 struct thing
26 { };
27
28//
29template<typename _Tp>
30 void
31 test_comparison()
32 {
33 constexpr std::complex<_Tp> a{1.1, 2.2};
34 constexpr std::complex<_Tp> b{3.3, 4.4};
35 if constexpr (a == b)
36 auto c [[maybe_unused]] = a + b;
37 if constexpr (a != b)
38 auto c [[maybe_unused]] = a - b;
39
40 thing<a == b> thing1 [[maybe_unused]];
41 thing<a != b> thing2 [[maybe_unused]];
42 }
43
44int
45main()
46{
47 test_comparison<float>();
48 test_comparison<double>();
49 test_comparison<long double>();
50
51 return 0;
52}