1 // Copyright (C) 2009-2014 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
19 // { dg-require-effective-target dfp }
21 // Test that binary comparison operators do not accept mixed decimal
22 // and generic floating-point operands. This isn't explicity prohibited
23 // in ISO/IEC TR 24733 but it is prohibited in C, and in C++ there should
24 // not be an implicit conversion from a decimal floating-point type to a
25 // generic floating-point type.
27 #include <decimal/decimal>
29 using namespace std::decimal
;
31 decimal32 a32
, b32
, c32
;
32 decimal64 a64
, b64
, c64
;
33 decimal128 a128
, b128
, c128
;
37 bool b1
, b2
, b3
, b4
, b5
, b6
;
42 b1
= b32
== f
; // { dg-error "error" }
43 b2
= ld
== b32
; // { dg-error "error" }
44 b3
= b64
== d
; // { dg-error "error" }
45 b4
= ld
== b64
; // { dg-error "error" }
46 b5
= b128
== ld
; // { dg-error "error" }
47 b6
= d
== b128
; // { dg-error "error" }
53 b1
= b32
!= f
; // { dg-error "error" }
54 b2
= ld
!= b32
; // { dg-error "error" }
55 b3
= b64
!= d
; // { dg-error "error" }
56 b4
= ld
!= b64
; // { dg-error "error" }
57 b5
= b128
!= ld
; // { dg-error "error" }
58 b6
= d
!= b128
; // { dg-error "error" }
64 b1
= b32
< f
; // { dg-error "error" }
65 b2
= ld
< b32
; // { dg-error "error" }
66 b3
= b64
< d
; // { dg-error "error" }
67 b4
= ld
< b64
; // { dg-error "error" }
68 b5
= b128
< ld
; // { dg-error "error" }
69 b6
= d
< b128
; // { dg-error "error" }
75 b1
= b32
<= f
; // { dg-error "error" }
76 b2
= ld
<= b32
; // { dg-error "error" }
77 b3
= b64
<= d
; // { dg-error "error" }
78 b4
= ld
<= b64
; // { dg-error "error" }
79 b5
= b128
<= ld
; // { dg-error "error" }
80 b6
= d
<= b128
; // { dg-error "error" }
86 b1
= b32
> f
; // { dg-error "error" }
87 b2
= ld
> b32
; // { dg-error "error" }
88 b3
= b64
> d
; // { dg-error "error" }
89 b4
= ld
> b64
; // { dg-error "error" }
90 b5
= b128
> ld
; // { dg-error "error" }
91 b6
= d
> b128
; // { dg-error "error" }
97 b1
= b32
>= f
; // { dg-error "error" }
98 b2
= ld
>= b32
; // { dg-error "error" }
99 b3
= b64
>= d
; // { dg-error "error" }
100 b4
= ld
>= b64
; // { dg-error "error" }
101 b5
= b128
>= ld
; // { dg-error "error" }
102 b6
= d
>= b128
; // { dg-error "error" }