]>
gcc.gnu.org Git - gcc.git/blob - libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.cc
2 // { dg-options "-std=gnu++11" }
4 // Copyright (C) 2010-2015 Free Software Foundation, Inc.
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)
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.
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/>.
23 // User defined type, so that the primary std::complex template is used.
32 struct ldld_lit
: public ldld_base
35 struct ldld_nonlit
: public ldld_base
41 operator<(const ldld_base __a
, const ldld_base __b
)
42 { return __a
.one
< __b
.one
&& __a
.two
< __b
.two
; }
45 operator==(const ldld_base __a
, const ldld_base __b
)
46 { return __a
.one
== __b
.one
&& __a
.two
== __b
.two
; }
49 operator+=(const ldld_base __a
, const ldld_base __b
)
50 { return ldld_base({ __a
.one
+ __b
.one
, __a
.two
+ __b
.two
}); }
53 operator-=(const ldld_base __a
, const ldld_base __b
)
54 { return ldld_base({ __a
.one
- __b
.one
, __a
.two
- __b
.two
}); }
57 operator*=(const ldld_base __a
, const ldld_base __b
)
58 { return ldld_base({ __a
.one
* __b
.one
, __a
.two
* __b
.two
}); }
61 operator/=(const ldld_base __a
, const ldld_base __b
)
62 { return ldld_base({ __a
.one
/ __b
.one
, __a
.two
/ __b
.two
}); }
66 constexpr std::complex<numext::ldld_lit
> lit
; // ok
67 // constexpr std::complex<numext::ldld_nonlit> nonlit; // error
This page took 0.038524 seconds and 5 git commands to generate.