| Issue |
239851
|
| Summary |
[libc++][test] `std::complex` tests should avoid unspecified behavior with integral types
|
| Labels |
libc++
|
| Assignees |
|
| Reporter |
StephanTLavavej
|
[N5054](https://isocpp.org/files/papers/N5054.pdf) \[complex.numbers.general\]/2:
> The effect of instantiating the primary template of `complex` for any type that is not a cv-unqualified floating-point type is unspecified.
MSVC's STL is planning to make the primary template emit a `static_assert` (which is one possible consequence of unspecified behavior).
libc++'s test suite is unconditionally exercising `complex<IntegralType>` in 7 tests. Can these tests be updated to avoid the unspecified behavior? Guarding this coverage for libc++ specifically would be totally fine.
This is an exhaustive list of the affected tests:
```
std/numerics/complex.number/cmplx.over/imag.pass.cpp
std/numerics/complex.number/cmplx.over/real.pass.cpp
std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp
std/numerics/complex.number/complex.member.ops/minus_equal_complex.pass.cpp
std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp
std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp
std/numerics/complex.number/complex.members/real_imag.pass.cpp
```
<details><summary>Click to expand examples of affected lines (I'm not sure whether this is exhaustive, but the tests are quite small):</summary>
https://github.com/llvm/llvm-project/blob/3f2e1be9cecea5e82690df0ebd16e83b7d18c7b4/libcxx/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp#L64-L66
https://github.com/llvm/llvm-project/blob/3f2e1be9cecea5e82690df0ebd16e83b7d18c7b4/libcxx/test/std/numerics/complex.number/cmplx.over/real.pass.cpp#L64-L66
https://github.com/llvm/llvm-project/blob/3f2e1be9cecea5e82690df0ebd16e83b7d18c7b4/libcxx/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp#L38
https://github.com/llvm/llvm-project/blob/3f2e1be9cecea5e82690df0ebd16e83b7d18c7b4/libcxx/test/std/numerics/complex.number/complex.member.ops/minus_equal_complex.pass.cpp#L37
https://github.com/llvm/llvm-project/blob/3f2e1be9cecea5e82690df0ebd16e83b7d18c7b4/libcxx/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp#L37
https://github.com/llvm/llvm-project/blob/3f2e1be9cecea5e82690df0ebd16e83b7d18c7b4/libcxx/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp#L37
https://github.com/llvm/llvm-project/blob/3f2e1be9cecea5e82690df0ebd16e83b7d18c7b4/libcxx/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp#L66
</details>
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs