|900 ms||libcxx CI C++2b > llvm-libc++-shared-cfg-in.std/utilities/function_objects/func_wrap/func_wrap_func/func_wrap_func_con::ctad.static.compile.pass.cpp|
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-16 /home/libcxx-builder/.buildkite-agent/builds/ecbe5da2461d-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/ctad.static.compile.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/ecbe5da2461d-1/llvm-project/libcxx-ci/build/generic-cxx2b/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/ecbe5da2461d-1/llvm-project/libcxx-ci/build/generic-cxx2b/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/ecbe5da2461d-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fsyntax-only
|80 ms||libcxx CI Modular build > llvm-libc++-shared-cfg-in.std/utilities/function_objects/func_wrap/func_wrap_func/func_wrap_func_con::ctad.static.compile.pass.cpp|
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-16 /home/libcxx-builder/.buildkite-agent/builds/aa423855f398-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/ctad.static.compile.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/aa423855f398-1/llvm-project/libcxx-ci/build/generic-modules/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/aa423855f398-1/llvm-project/libcxx-ci/build/generic-modules/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/aa423855f398-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -fmodules -fcxx-modules -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fsyntax-only
Because people run their code sometimes. And we should too.
And because writing holistic tests catches more than just bugs in the change.
They can catch compiler frontend and backend bugs, latent bugs in existing code, etc.
Because shipping a bug in libc++ is such a high cost, it's worth it to test more than the bare minimum.
Yes, it deduces to the correct type. But does it correctly call the constructor and store the pointer? It should, but does it?
More generally speaking, I think Eric's point is that we should also add tests that ensure that std::function works with a static operator(), regardless of CTAD. I agree with that, however I can see why that could be seen as separate from this patch.
But yes, I think we should definitely have runtime tests to check the interaction of static operator() and std::function.
Why do we support this pre-C++23?
No, I just missed them somehow. It also seems that we don't have CTAD implemented for packaged_task yet, so I did it here.
I would consider this a separate issue, since there are probably other areas where we want to add static operator() tests.
Because my plan is to use static operator() for the implementation of the ranges algorithms, since it improves code gen.
This LGTM with my comments.
Range algorithms can't be passed to std::function if we follow the letter of the standard. I don't think we should attempt to support this before C++23. If we do, then we are almost certainly missing similar things elsewhere in the library, which would make our support for that spotty anyway.
Let's just implement this in C++23, as specified, and we can make our ranges algorithms' operator() static, which shouldn't be detectable. While people can technically detect it by looking at the type of e.g. std::ranges::copy::operator(), they are not allowed to do that in the first place, which makes this undetectable.
Let's mark this as UNSUPPORTED: clang-14, clang-15, gcc-12 instead.
Please add a few more cases: 0 arguments, 1 argument, variadic arguments, default argument (why not?).
Also, let's run these tests (not compile only), unless you sign up to address the more general issue of testing the integration of static operator() in std::function (and probably other places). If you don't sign up for that, then let's run these tests cause that's going to be better than nothing.
- Address comments
- Try to fix CI
No, this has been added in C++17.
No, this is from LWG3117, which IIUC should be applied retroactively to C++17.
I'm XFAILing it to ensure we test it on all compilers that support static operator().
I'd rather do it not at all or properly, than half-assed, so I guess I'm signing up for it. Otherwise it probably happens in 5 years.