46a38acd3ed870af05ba620d34ba0f914d678822
1 // Copyright (C) 2009 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>
28 #include <testsuite_hooks.h>
30 using namespace std::decimal
;
32 decimal32 a32
, b32
, c32
;
33 decimal64 a64
, b64
, c64
;
34 decimal128 a128
, b128
, c128
;
38 bool b1
, b2
, b3
, b4
, b5
, b6
;
43 b1
= b32
== f
; // { dg-error "error" }
44 b2
= ld
== b32
; // { dg-error "error" }
45 b3
= b64
== d
; // { dg-error "error" }
46 b4
= ld
== b64
; // { dg-error "error" }
47 b5
= b128
== ld
; // { dg-error "error" }
48 b6
= d
== b128
; // { dg-error "error" }
54 b1
= b32
!= f
; // { dg-error "error" }
55 b2
= ld
!= b32
; // { dg-error "error" }
56 b3
= b64
!= d
; // { dg-error "error" }
57 b4
= ld
!= b64
; // { dg-error "error" }
58 b5
= b128
!= ld
; // { dg-error "error" }
59 b6
= d
!= b128
; // { dg-error "error" }
65 b1
= b32
< f
; // { dg-error "error" }
66 b2
= ld
< b32
; // { dg-error "error" }
67 b3
= b64
< d
; // { dg-error "error" }
68 b4
= ld
< b64
; // { dg-error "error" }
69 b5
= b128
< ld
; // { dg-error "error" }
70 b6
= d
< b128
; // { dg-error "error" }
76 b1
= b32
<= f
; // { dg-error "error" }
77 b2
= ld
<= b32
; // { dg-error "error" }
78 b3
= b64
<= d
; // { dg-error "error" }
79 b4
= ld
<= b64
; // { dg-error "error" }
80 b5
= b128
<= ld
; // { dg-error "error" }
81 b6
= d
<= b128
; // { dg-error "error" }
87 b1
= b32
> f
; // { dg-error "error" }
88 b2
= ld
> b32
; // { dg-error "error" }
89 b3
= b64
> d
; // { dg-error "error" }
90 b4
= ld
> b64
; // { dg-error "error" }
91 b5
= b128
> ld
; // { dg-error "error" }
92 b6
= d
> b128
; // { dg-error "error" }
98 b1
= b32
>= f
; // { dg-error "error" }
99 b2
= ld
>= b32
; // { dg-error "error" }
100 b3
= b64
>= d
; // { dg-error "error" }
101 b4
= ld
>= b64
; // { dg-error "error" }
102 b5
= b128
>= ld
; // { dg-error "error" }
103 b6
= d
>= b128
; // { dg-error "error" }
106 // { dg-excess-errors "notes about candidates" }