1 /* { dg-do compile } */
2 /* { dg-options "-std=gnu99" } */
4 /* C99 6.5.10: Bitwise AND operator.
5 C99 6.5.11: Bitwise exclusive OR operator.
6 C99 6.5.12: Bitwise inclusive OR operator.
8 Test that these operators do not accept decimal float operands. */
10 extern void abort (void);
12 #define OPERATE(OPRD1,OPRT,OPRD2) \
20 #define DECIMAL_BITWISE_OPERATOR(OPRT,OPRD) \
23 OPERATE(OPRD,OPRT,1); \
24 OPERATE(OPRD,OPRT,0); \
25 OPERATE(OPRD,OPRT,0x15); \
26 OPERATE(0,OPRT,OPRD); \
27 OPERATE(1,OPRT,OPRD); \
28 OPERATE(0x15,OPRT,OPRD); \
31 void operator_notfor_decimal()
37 /* C99 Section 6.5.7 Bitwise shift operators. Operands must have
38 integer type (which the decimal float types are not). */
40 d32 << 1; /* { dg-error "invalid operands to binary" } */
41 d32 >> 1; /* { dg-error "invalid operands to binary" } */
42 d64 << 1; /* { dg-error "invalid operands to binary" } */
43 d64 >> 1; /* { dg-error "invalid operands to binary" } */
44 d128 << 1; /* { dg-error "invalid operands to binary" } */
45 d128 >> 1; /* { dg-error "invalid operands to binary" } */
47 DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
48 DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
49 DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
51 /* C99 Section 6.5.{10,11,12} Bitwise operator. Constraints: Each of
52 the operands shall have integer type. DFP type is reject by compiler
53 when bitwise operation is performed. */
55 DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
56 DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
57 DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
59 DECIMAL_BITWISE_OPERATOR(|,d32); /* { dg-error "invalid operands to binary" } */
60 DECIMAL_BITWISE_OPERATOR(|,d64); /* { dg-error "invalid operands to binary" } */
61 DECIMAL_BITWISE_OPERATOR(|,d128); /* { dg-error "invalid operands to binary" } */
63 DECIMAL_BITWISE_OPERATOR(^,d32); /* { dg-error "invalid operands to binary" } */
64 DECIMAL_BITWISE_OPERATOR(^,d64); /* { dg-error "invalid operands to binary" } */
65 DECIMAL_BITWISE_OPERATOR(^,d128); /* { dg-error "invalid operands to binary" } */