fff81d1c06f5e8e73e8b1f9fd24eb9ab826c97e2
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 C++ binary operators that are restricted to integer operands
22 // do not accept decimal float operands.
24 #include <decimal/decimal>
26 using namespace std::decimal
;
28 decimal32 a32
, b32
, c32
;
29 decimal64 a64
, b64
, c64
;
30 decimal128 a128
, b128
, c128
;
35 a32
= b32
% c32
; // { dg-error "error" }
36 a64
= b64
% c64
; // { dg-error "error" }
37 a128
= b128
% c128
; // { dg-error "error" }
38 a128
= b32
% c128
; // { dg-error "error" }
39 a128
= b64
% c128
; // { dg-error "error" }
40 a32
= 100 % c32
; // { dg-error "error" }
41 a64
= 10 % c64
; // { dg-error "error" }
42 a128
= 1000 % c128
; // { dg-error "error" }
43 a32
= b32
% 7; // { dg-error "error" }
44 a64
= b64
% 5; // { dg-error "error" }
45 a128
= b128
% 3; // { dg-error "error" }
49 bitwise_right_shift (void)
51 a32
= b32
>> c32
; // { dg-error "error" }
52 a64
= b64
>> c64
; // { dg-error "error" }
53 a128
= b128
>> c128
; // { dg-error "error" }
54 a128
= b32
>> c128
; // { dg-error "error" }
55 a128
= b64
>> c128
; // { dg-error "error" }
56 a32
= 100 >> c32
; // { dg-error "error" }
57 a64
= 10 >> c64
; // { dg-error "error" }
58 a128
= 1000 >> c128
; // { dg-error "error" }
59 a32
= b32
>> 7; // { dg-error "error" }
60 a64
= b64
>> 5; // { dg-error "error" }
61 a128
= b128
>> 3; // { dg-error "error" }
65 bitwise_left_shift (void)
67 a32
= b32
<< c32
; // { dg-error "error" }
68 a64
= b64
<< c64
; // { dg-error "error" }
69 a128
= b128
<< c128
; // { dg-error "error" }
70 a128
= b32
<< c128
; // { dg-error "error" }
71 a128
= b64
<< c128
; // { dg-error "error" }
72 a32
= 100 << c32
; // { dg-error "error" }
73 a64
= 10 << c64
; // { dg-error "error" }
74 a128
= 1000 << c128
; // { dg-error "error" }
75 a32
= b32
<< 7; // { dg-error "error" }
76 a64
= b64
<< 5; // { dg-error "error" }
77 a128
= b128
<< 3; // { dg-error "error" }
81 bitwise_exclusive_or (void)
83 a32
= b32
^ c32
; // { dg-error "error" }
84 a64
= b64
^ c64
; // { dg-error "error" }
85 a128
= b128
^ c128
; // { dg-error "error" }
86 a128
= b32
^ c128
; // { dg-error "error" }
87 a128
= b64
^ c128
; // { dg-error "error" }
88 a32
= 100 ^ c32
; // { dg-error "error" }
89 a64
= 10 ^ c64
; // { dg-error "error" }
90 a128
= 1000 ^ c128
; // { dg-error "error" }
91 a32
= b32
^ 7; // { dg-error "error" }
92 a64
= b64
^ 5; // { dg-error "error" }
93 a128
= b128
^ 3; // { dg-error "error" }
97 bitwise_inclusive_or (void)
99 a32
= b32
| c32
; // { dg-error "error" }
100 a64
= b64
| c64
; // { dg-error "error" }
101 a128
= b128
| c128
; // { dg-error "error" }
102 a128
= b32
| c128
; // { dg-error "error" }
103 a128
= b64
| c128
; // { dg-error "error" }
104 a32
= 100 | c32
; // { dg-error "error" }
105 a64
= 10 | c64
; // { dg-error "error" }
106 a128
= 1000 | c128
; // { dg-error "error" }
107 a32
= b32
| 7; // { dg-error "error" }
108 a64
= b64
| 5; // { dg-error "error" }
109 a128
= b128
| 3; // { dg-error "error" }
115 a32
= b32
&& c32
; // { dg-error "error" }
116 a64
= b64
&& c64
; // { dg-error "error" }
117 a128
= b128
&& c128
; // { dg-error "error" }
118 a128
= b32
&& c128
; // { dg-error "error" }
119 a128
= b64
&& c128
; // { dg-error "error" }
120 a32
= 100 && c32
; // { dg-error "error" }
121 a64
= 10 && c64
; // { dg-error "error" }
122 a128
= 1000 && c128
; // { dg-error "error" }
123 a32
= b32
&& 7; // { dg-error "error" }
124 a64
= b64
&& 5; // { dg-error "error" }
125 a128
= b128
&& 3; // { dg-error "error" }
131 a32
= b32
|| c32
; // { dg-error "error" }
132 a64
= b64
|| c64
; // { dg-error "error" }
133 a128
= b128
|| c128
; // { dg-error "error" }
134 a128
= b32
|| c128
; // { dg-error "error" }
135 a128
= b64
|| c128
; // { dg-error "error" }
136 a32
= 100 || c32
; // { dg-error "error" }
137 a64
= 10 || c64
; // { dg-error "error" }
138 a128
= 1000 || c128
; // { dg-error "error" }
139 a32
= b32
|| 7; // { dg-error "error" }
140 a64
= b64
|| 5; // { dg-error "error" }
141 a128
= b128
|| 3; // { dg-error "error" }
145 bitwise_complement (void)
147 a32
= ~b32
; // { dg-error "error" }
148 a64
= ~b64
; // { dg-error "error" }
149 a128
= ~b128
; // { dg-error "error" }
155 a32
= !b32
; // { dg-error "error" }
156 a64
= !b64
; // { dg-error "error" }
157 a128
= !b128
; // { dg-error "error" }
160 // { dg-excess-errors "" { target *-*-* } }