1 /* { dg-do compile } */
3 /* C99 6.5.10: Bitwise AND operator.
4 C99 6.5.11: Bitwise exclusive OR operator.
5 C99 6.5.12: Bitwise inclusive OR operator.
7 Test that these operators do not accept decimal float operands. */
9 #define OPERATE(OPRD1,OPRT,OPRD2) \
17 #define DECIMAL_BITWISE_OPERATOR(OPRT,OPRD) \
20 OPERATE(OPRD,OPRT,1); \
21 OPERATE(OPRD,OPRT,0); \
22 OPERATE(OPRD,OPRT,0x15); \
23 OPERATE(0,OPRT,OPRD); \
24 OPERATE(1,OPRT,OPRD); \
25 OPERATE(0x15,OPRT,OPRD); \
28 void operator_notfor_decimal()
34 /* C99 Section 6.5.7 Bitwise shift operators. Operands must have
35 integer type (which the decimal float types are not). */
37 d32
<< 1; /* { dg-error "invalid operands to binary" } */
38 d32
>> 1; /* { dg-error "invalid operands to binary" } */
39 d64
<< 1; /* { dg-error "invalid operands to binary" } */
40 d64
>> 1; /* { dg-error "invalid operands to binary" } */
41 d128
<< 1; /* { dg-error "invalid operands to binary" } */
42 d128
>> 1; /* { dg-error "invalid operands to binary" } */
44 DECIMAL_BITWISE_OPERATOR(&,d32
); /* { dg-error "invalid operands to binary" } */
45 DECIMAL_BITWISE_OPERATOR(&,d64
); /* { dg-error "invalid operands to binary" } */
46 DECIMAL_BITWISE_OPERATOR(&,d128
); /* { dg-error "invalid operands to binary" } */
48 /* C99 Section 6.5.{10,11,12} Bitwise operator. Constraints: Each of
49 the operands shall have integer type. DFP type is reject by compiler
50 when bitwise operation is performed. */
52 DECIMAL_BITWISE_OPERATOR(&,d32
); /* { dg-error "invalid operands to binary" } */
53 DECIMAL_BITWISE_OPERATOR(&,d64
); /* { dg-error "invalid operands to binary" } */
54 DECIMAL_BITWISE_OPERATOR(&,d128
); /* { dg-error "invalid operands to binary" } */
56 DECIMAL_BITWISE_OPERATOR(|,d32
); /* { dg-error "invalid operands to binary" } */
57 DECIMAL_BITWISE_OPERATOR(|,d64
); /* { dg-error "invalid operands to binary" } */
58 DECIMAL_BITWISE_OPERATOR(|,d128
); /* { dg-error "invalid operands to binary" } */
60 DECIMAL_BITWISE_OPERATOR(^,d32
); /* { dg-error "invalid operands to binary" } */
61 DECIMAL_BITWISE_OPERATOR(^,d64
); /* { dg-error "invalid operands to binary" } */
62 DECIMAL_BITWISE_OPERATOR(^,d128
); /* { dg-error "invalid operands to binary" } */