| 1 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-linux -verify=no-diag \ |
| 2 |
// RUN: -DDIV_CC -DDIV_RC -DDIVASSIGN -DDIVMIXEDFD -DDIVMIXEDFD2 -DDIVMIXEDID -DDIVASSIGN_MIXEDFD |
| 3 |
|
| 4 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify=no-diag |
| 5 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify -DDIV_CC |
| 6 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify -DDIV_RC |
| 7 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify -DDIVASSIGN |
| 8 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify -DDIVMIXEDFD |
| 9 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify -DDIVMIXEDFD2 |
| 10 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify -DDIVMIXEDID |
| 11 |
// RUN: %clang_cc1 %s -complex-range=promoted -fsyntax-only -triple x86_64-unknown-windows -verify -DDIVASSIGN_MIXEDFD |
| 12 |
|
| 13 |
_Complex double div_ccf(_Complex float a, _Complex float b) { |
| 14 |
return a / b; |
| 15 |
} |
| 16 |
|
| 17 |
_Complex double div_cr(_Complex double a, double b) { |
| 18 |
return a / b; |
| 19 |
} |
| 20 |
|
| 21 |
_Complex double div_cr_mixed1(_Complex double a, float b) { |
| 22 |
return a / b; |
| 23 |
} |
| 24 |
|
| 25 |
_Complex double div_cr_mixed2(_Complex float a, double b) { |
| 26 |
return a / b; |
| 27 |
} |
| 28 |
|
| 29 |
_Complex double div_rr(double a, double b) { |
| 30 |
return a / b; |
| 31 |
} |
| 32 |
|
| 33 |
_Complex int div_ii(_Complex int a, _Complex int b) { |
| 34 |
return a / b; |
| 35 |
} |
| 36 |
|
| 37 |
struct UserT { |
| 38 |
friend UserT operator/(UserT, _Complex double); |
| 39 |
friend UserT operator/(_Complex double, UserT); |
| 40 |
}; |
| 41 |
|
| 42 |
UserT div_uc(UserT a, _Complex double b) { |
| 43 |
return a / b; |
| 44 |
} |
| 45 |
|
| 46 |
UserT div_cu(_Complex double a, UserT b) { |
| 47 |
return a / b; |
| 48 |
} |
| 49 |
|
| 50 |
#ifdef DIV_CC |
| 51 |
_Complex double div_cc(_Complex double a, const _Complex double b) { |
| 52 |
return a / b; // #1 |
| 53 |
} |
| 54 |
#endif // DIV_CC |
| 55 |
|
| 56 |
#ifdef DIV_RC |
| 57 |
_Complex double div_rc(double a, _Complex float b) { |
| 58 |
return a / b; // #1 |
| 59 |
} |
| 60 |
#endif // DIV_RC |
| 61 |
|
| 62 |
#ifdef DIVASSIGN |
| 63 |
_Complex double divassign(_Complex double a, _Complex double b) { |
| 64 |
return a /= b; // #1 |
| 65 |
} |
| 66 |
#endif // DIVASSIGN |
| 67 |
|
| 68 |
#ifdef DIVMIXEDFD |
| 69 |
_Complex double divmixedfd(_Complex float a, _Complex double b) { |
| 70 |
return a / b; // #1 |
| 71 |
} |
| 72 |
#endif // DIVMIXEDFD |
| 73 |
|
| 74 |
#ifdef DIVMIXEDFD2 |
| 75 |
_Complex double divmixedfd2(_Complex double a, _Complex float b) { |
| 76 |
return a / b; // #1 |
| 77 |
} |
| 78 |
#endif // DIVMIXEDFD2 |
| 79 |
|
| 80 |
#ifdef DIVMIXEDID |
| 81 |
_Complex double divmixedid(_Complex int a, _Complex double b) { |
| 82 |
return a / b; // #1 |
| 83 |
} |
| 84 |
#endif // DIVMIXEDID |
| 85 |
|
| 86 |
#ifdef DIVASSIGN_MIXEDFD |
| 87 |
_Complex double divassign_mixedfd(_Complex float a, _Complex double b) { |
| 88 |
return a /= b; // #1 |
| 89 |
} |
| 90 |
#endif // DIVMIXEDFD |
| 91 |
|
| 92 |
// no-diag-no-diagnostics |
| 93 |
// expected-warning@#1 {{excess precision is requested but the target does not support excess precision which may result in observable differences in complex division behavior}} |