Page MenuHomePhabricator

[libc++] Implement not-yet-voted LWG3436
Needs ReviewPublic

Authored by ldionne on Nov 26 2021, 9:53 AM.

Details

Reviewers
rsmith
Group Reviewers
Restricted Project
Summary

LWG3436 adds support for array types in construct_at. That is necessary
for implementing other voted features, such as arrays in make_shared, so
I am extraordinarily implementing the LWG resolution despite it not
being voted into the Standard yet.

Diff Detail

Unit TestsFailed

TimeTest
970 mslibcxx CI C++20 > llvm-libc++-shared-cfg-in.std/utilities/memory/specialized_algorithms/specialized_construct::construct_at.LWG3436.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.LWG3436.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/build/generic-cxx20/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/build/generic-cxx20/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++20 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/build/generic-cxx20/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/build/generic-cxx20/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/8081e1829473-1/llvm-project/libcxx-ci/build/generic-cxx20/std/utilities/memory/specialized.algorithms/specialized.construct/Output/construct_at.LWG3436.pass.cpp.dir/t.tmp.exe
880 mslibcxx CI C++2b > llvm-libc++-shared-cfg-in.std/utilities/memory/specialized_algorithms/specialized_construct::construct_at.LWG3436.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.LWG3436.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/build/generic-cxx2b/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/build/generic-cxx2b/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/build/generic-cxx2b/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/build/generic-cxx2b/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/0c8e7bffd525-1/llvm-project/libcxx-ci/build/generic-cxx2b/std/utilities/memory/specialized.algorithms/specialized.construct/Output/construct_at.LWG3436.pass.cpp.dir/t.tmp.exe
820 mslibcxx CI GCC 11 / C++latest > llvm-libc++-shared-gcc-cfg-in.std/utilities/memory/specialized_algorithms/specialized_construct::construct_at.LWG3436.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/g++-11 /home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.LWG3436.pass.cpp -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/build/generic-gcc/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/build/generic-gcc/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-aligned-allocation-unavailable -Wno-atomic-alignment -Wno-sized-deallocation -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -L /home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/build/generic-gcc/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/build/generic-gcc/lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic -o /home/libcxx-builder/.buildkite-agent/builds/961a926f06b9-1/llvm-project/libcxx-ci/build/generic-gcc/std/utilities/memory/specialized.algorithms/specialized.construct/Output/construct_at.LWG3436.pass.cpp.dir/t.tmp.exe

Event Timeline

ldionne requested review of this revision.Nov 26 2021, 9:53 AM
ldionne created this revision.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 26 2021, 9:53 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

@rsmith I suspect that enabling array placement new properly will be more complicated than this, but this simple change solved my immediate issue. Please let me know if that's insufficient.

Since this patch requires both an update to both Clang and libc++ I think it would land the Clang part in a separate patch. Then wait for the CI to have ToT with this version and land that separately.
For now can you run the CI with the Bootstrap build?

libcxx/include/__memory/construct_at.h
40

Please add here also you implement the resolution of 2021-01-16.
I was wondering whether we should add it to the status list for C++23, but looking at the issue it's not certain it will be in C++23.

ldionne marked an inline comment as done.Dec 1 2021, 12:45 PM

Since this patch requires both an update to both Clang and libc++ I think it would land the Clang part in a separate patch. Then wait for the CI to have ToT with this version and land that separately.
For now can you run the CI with the Bootstrap build?

D114649 is the Clang patch!