1 |
742 |
jeremybenn |
// Copyright (C) 2009 Free Software Foundation, Inc.
|
2 |
|
|
//
|
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)
|
7 |
|
|
// any later version.
|
8 |
|
|
|
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.
|
13 |
|
|
|
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/>.
|
17 |
|
|
|
18 |
|
|
// { dg-do compile }
|
19 |
|
|
// { dg-require-effective-target dfp }
|
20 |
|
|
|
21 |
|
|
// Test that C++ binary operators that are restricted to integer operands
|
22 |
|
|
// do not accept decimal float operands.
|
23 |
|
|
|
24 |
|
|
#include <decimal/decimal>
|
25 |
|
|
|
26 |
|
|
using namespace std::decimal;
|
27 |
|
|
|
28 |
|
|
decimal32 a32, b32, c32;
|
29 |
|
|
decimal64 a64, b64, c64;
|
30 |
|
|
decimal128 a128, b128, c128;
|
31 |
|
|
|
32 |
|
|
void
|
33 |
|
|
modulus (void)
|
34 |
|
|
{
|
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" }
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
void
|
49 |
|
|
bitwise_right_shift (void)
|
50 |
|
|
{
|
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" }
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
void
|
65 |
|
|
bitwise_left_shift (void)
|
66 |
|
|
{
|
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" }
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
void
|
81 |
|
|
bitwise_exclusive_or (void)
|
82 |
|
|
{
|
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" }
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
void
|
97 |
|
|
bitwise_inclusive_or (void)
|
98 |
|
|
{
|
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" }
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
void
|
113 |
|
|
logical_and (void)
|
114 |
|
|
{
|
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" }
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
void
|
129 |
|
|
logical_or (void)
|
130 |
|
|
{
|
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" }
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
void
|
145 |
|
|
bitwise_complement (void)
|
146 |
|
|
{
|
147 |
|
|
a32 = ~b32; // { dg-error "error" }
|
148 |
|
|
a64 = ~b64; // { dg-error "error" }
|
149 |
|
|
a128 = ~b128; // { dg-error "error" }
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
void
|
153 |
|
|
logical_not (void)
|
154 |
|
|
{
|
155 |
|
|
a32 = !b32; // { dg-error "error" }
|
156 |
|
|
a64 = !b64; // { dg-error "error" }
|
157 |
|
|
a128 = !b128; // { dg-error "error" }
|
158 |
|
|
}
|
159 |
|
|
|