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 arithmetic operators do not accept mixed decimal
22 // and generic floating-point operands. This isn't explicity
23 // prohibited in ISO/IEC TR 24733 but it is prohibited in C, and in C++
24 // there should not be an implicit conversion from a decimal
25 // floating-point type to a 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 a32
= b32
+ f
; // { dg-error "error" }
44 a32
= ld
+ b32
; // { dg-error "error" }
45 a64
= b64
+ d
; // { dg-error "error" }
46 a64
= ld
+ b64
; // { dg-error "error" }
47 a128
= b128
+ ld
; // { dg-error "error" }
48 a128
= d
+ b128
; // { dg-error "error" }
54 a32
= b32
- f
; // { dg-error "error" }
55 a32
= ld
- b32
; // { dg-error "error" }
56 a64
= b64
- d
; // { dg-error "error" }
57 a64
= ld
- b64
; // { dg-error "error" }
58 a128
= b128
- ld
; // { dg-error "error" }
59 a128
= d
- b128
; // { dg-error "error" }
65 a32
= b32
* f
; // { dg-error "error" }
66 a32
= ld
* b32
; // { dg-error "error" }
67 a64
= b64
* d
; // { dg-error "error" }
68 a64
= ld
* b64
; // { dg-error "error" }
69 a128
= b128
* ld
; // { dg-error "error" }
70 a128
= d
* b128
; // { dg-error "error" }
76 a32
= b32
/ f
; // { dg-error "error" }
77 a32
= ld
/ b32
; // { dg-error "error" }
78 a64
= b64
/ d
; // { dg-error "error" }
79 a64
= ld
/ b64
; // { dg-error "error" }
80 a128
= b128
/ ld
; // { dg-error "error" }
81 a128
= d
/ b128
; // { dg-error "error" }
87 a32
+= f
; // { dg-error "error" }
88 a32
+= d
; // { dg-error "error" }
89 a32
+= ld
; // { dg-error "error" }
90 a64
+= f
; // { dg-error "error" }
91 a64
+= d
; // { dg-error "error" }
92 a64
+= ld
; // { dg-error "error" }
93 a128
+= f
; // { dg-error "error" }
94 a128
+= d
; // { dg-error "error" }
95 a128
+= ld
; // { dg-error "error" }
101 a32
-= f
; // { dg-error "error" }
102 a32
-= d
; // { dg-error "error" }
103 a32
-= ld
; // { dg-error "error" }
104 a64
-= f
; // { dg-error "error" }
105 a64
-= d
; // { dg-error "error" }
106 a64
-= ld
; // { dg-error "error" }
107 a128
-= f
; // { dg-error "error" }
108 a128
-= d
; // { dg-error "error" }
109 a128
-= ld
; // { dg-error "error" }
115 a32
*= f
; // { dg-error "error" }
116 a32
*= d
; // { dg-error "error" }
117 a32
*= ld
; // { dg-error "error" }
118 a64
*= f
; // { dg-error "error" }
119 a64
*= d
; // { dg-error "error" }
120 a64
*= ld
; // { dg-error "error" }
121 a128
*= f
; // { dg-error "error" }
122 a128
*= d
; // { dg-error "error" }
123 a128
*= ld
; // { dg-error "error" }
129 a32
/= f
; // { dg-error "error" }
130 a32
/= d
; // { dg-error "error" }
131 a32
/= ld
; // { dg-error "error" }
132 a64
/= f
; // { dg-error "error" }
133 a64
/= d
; // { dg-error "error" }
134 a64
/= ld
; // { dg-error "error" }
135 a128
/= f
; // { dg-error "error" }
136 a128
/= d
; // { dg-error "error" }
137 a128
/= ld
; // { dg-error "error" }