Issue 241479
Summary [libc++][test] `test_comparisons.h` unconditionally includes `<compare>` and `<concepts>`
Labels libc++
Assignees
Reporter StephanTLavavej
    This is a minor issue, but I found it while temporarily modifying MSVC's STL to reject headers being included in the wrong modes. (Normally, we emit a warning and expand the header to nothing.)

`test/support/test_comparisons.h` unconditionally includes C++20 `<compare>` and `<concepts>`:

https://github.com/llvm/llvm-project/blob/4a6c93c2a5ee9516183159e83069e8a971ef7f65/libcxx/test/support/test_comparisons.h#L27-L28

It would be nice if these inclusions were guarded by `TEST_STD_VER`, as the following usage already is:

https://github.com/llvm/llvm-project/blob/4a6c93c2a5ee9516183159e83069e8a971ef7f65/libcxx/test/support/test_comparisons.h#L148-L153
https://github.com/llvm/llvm-project/blob/4a6c93c2a5ee9516183159e83069e8a971ef7f65/libcxx/test/support/test_comparisons.h#L311-L313

There are "entrypoints" in C++17 mode:

https://github.com/llvm/llvm-project/blob/cc6fe608a116ceef9b665cdc4af5bcf188e00c0c/libcxx/test/std/utilities/variant/variant.monostate.relops/relops.pass.cpp#L24

>From glancing at libc++'s product code, it looks like this isn't an issue for you because your headers have the same "expand to nothing in the wrong mode" behavior as MSVC's STL, except without emitting any warnings:

https://github.com/llvm/llvm-project/blob/cc6fe608a116ceef9b665cdc4af5bcf188e00c0c/libcxx/include/compare#L148

In any event, I think that guarding the inclusions in `test_comparisons.h` would be a good thing to do.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to