| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
/* Test various conversions involving decimal floating types. */ |
| 4 |
|
| 5 |
#include "dfp-dbg.h" |
| 6 |
|
| 7 |
/* Assertion that constant C is of type T. */ |
| 8 |
#define ASSERT_CONST_TYPE(C, T) \ |
| 9 |
do { \ |
| 10 |
typedef T type; \ |
| 11 |
typedef type **typepp; \ |
| 12 |
typedef __typeof__((C)) ctype; \ |
| 13 |
typedef ctype **ctypepp; \ |
| 14 |
typepp x = 0; \ |
| 15 |
ctypepp y = 0; \ |
| 16 |
x = y; \ |
| 17 |
y = x; \ |
| 18 |
} while (0) |
| 19 |
|
| 20 |
int |
| 21 |
main () |
| 22 |
{ |
| 23 |
ASSERT_CONST_TYPE (3 + 2.1df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */ |
| 24 |
ASSERT_CONST_TYPE (1.3df + 2, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */ |
| 25 |
ASSERT_CONST_TYPE (56U - 55.0dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */ |
| 26 |
ASSERT_CONST_TYPE (5 * .2DL, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */ |
| 27 |
ASSERT_CONST_TYPE (.88dl / 2L, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */ |
| 28 |
ASSERT_CONST_TYPE (.114df - 1.6dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */ |
| 29 |
ASSERT_CONST_TYPE (3L - 1 + .55df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */ |
| 30 |
|
| 31 |
return 0; |
| 32 |
} |