| 1 |
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both -Wno-unused-value %s |
| 2 |
// RUN: %clang_cc1 -verify=ref,both -Wno-unused-value %s |
| 3 |
|
| 4 |
void blah() { |
| 5 |
__complex__ unsigned xx; |
| 6 |
__complex__ signed yy; |
| 7 |
__complex__ int result; |
| 8 |
|
| 9 |
/// The following line calls into the constant interpreter. |
| 10 |
result = xx * yy; |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
_Static_assert((0.0 + 0.0j) == (0.0 + 0.0j), ""); |
| 15 |
_Static_assert((0.0 + 0.0j) != (0.0 + 0.0j), ""); // both-error {{static assertion}} \ |
| 16 |
// both-note {{evaluates to}} |
| 17 |
|
| 18 |
const _Complex float FC = {0.0f, 0.0f}; |
| 19 |
_Static_assert(!FC, ""); |
| 20 |
const _Complex float FI = {0, 0}; |
| 21 |
_Static_assert(!FI, ""); |
| 22 |
|
| 23 |
|
| 24 |
/// Make sure we're stripping the _Atomic part from the |
| 25 |
/// complex type. |
| 26 |
void testComplexFloat(_Atomic(_Complex float) *fp) { |
| 27 |
_Atomic(_Complex float) x = 2.0f; |
| 28 |
_Complex float f = *fp; |
| 29 |
*fp = f; |
| 30 |
} |