summaryrefslogtreecommitdiff
path: root/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
AgeCommit message (Collapse)Author
2024-06-26"[libc++] Try again LWG3233 Broken requirements for shared_ptr converting ↵Hui
constructors" (#96103) Try it again. Use the approach suggested by Tim in the LWG thread : using function default argument SFINAE - Revert "[libc++] Revert LWG3233 Broken requirements for shared_ptr converting constructors (#93071)" - Revert "[libc++] Revert temporary attempt to implement LWG 4110 (#95263)" - test for default_delete - Revert "Revert "[libc++] Revert temporary attempt to implement LWG 4110 (#95263)"" - test for NULL
2023-02-11[libc++] fix `shared_ptr`'s incorrect constraintsHui
Fix several bugs: 1. https://llvm.org/PR60258 The conversion constructors' constraint `__compatible_with` incorrectly allow array types conversion to scalar types 2. https://llvm.org/PR53368 The constructor that takes `unique_ptr` are not suffiently constrained. 3. The constructors that take raw pointers incorretly use `__compatible_with`. They have different constraints Differential Revision: https://reviews.llvm.org/D143346
2022-03-10[libc++] Add test coverage for std::shared_ptr<const T>Louis Dionne
Those tests were extracted from D120996. Differential Revision: https://reviews.llvm.org/D121340
2022-03-09Revert "[libc++] Remove extension to support allocator<const T>"Louis Dionne
This reverts commit 276ca873. That commit has quite a history at this point. It was first landed in dbc647643577, which broke std::shared_ptr<T const> and was reverted in 9138666f5. It was then re-applied in 276ca873, with the std::shared_ptr issue fixed, but it caused widespread breakage at Google (which suggests it would cause similar breakage in the wild too), so now I'm reverting again. Instead, I will add a escape hatch that vendors can turn on to enable the extension and perform a phased transition over one or two releases like we sometimes do when things become non-trivial.
2022-03-08[libc++] Remove extension to support allocator<const T>Louis Dionne
This extension is a portability trap for users, since no other standard library supports it. Furthermore, the Standard explicitly allows implementations to reject std::allocator<cv T>, so allowing it is really going against the current. This was discovered in D120684: this extension required `const_cast`ing in `__construct_range_forward`, a fishy bit of code that can be removed if we don't support the extension anymore. This is a re-application of dbc647643577, which was reverted in 9138666f5 because it broke std::shared_ptr<T const>. Tests have now been added and we've made sure that std::shared_ptr<T const> wouldn't be broken in this version. Differential Revision: https://reviews.llvm.org/D120996
2021-10-19[libc++] [test] Add tests for converting array types in shared_ptr.Konstantin Varlamov
The only possible kind of a conversion in initialization of a shared pointer to an array is a qualification conversion (i.e., adding cv-qualifiers). This patch adds tests for converting from `A[]` to `const A[]` to the following functions: ``` template<class Y> explicit shared_ptr(Y* p); template<class Y> shared_ptr(const shared_ptr<Y>& r); template<class Y> shared_ptr(shared_ptr<Y>&& r); template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r); template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r); template<class Y> void reset(Y* p); template<class Y, class D> void reset(Y* p, D d); template<class Y, class D, class A> void reset(Y* p, D d, A a); ``` Similar tests for converting functions that involve a `weak_ptr` should be added once LWG issue [3001](https://cplusplus.github.io/LWG/issue3001) is implemented. Differential Revision: https://reviews.llvm.org/D112048
2020-05-12[libcxx] Re-commit: shared_ptr changes from library fundamentals (P0414R2).zoecarver
Implements P0414R2: * Adds support for array types in std::shared_ptr. * Adds reinterpret_pointer_cast for shared_ptr. Re-committing now that the leaking tests are fixed. Differential Revision: https://reviews.llvm.org/D62259
2020-05-11Revert "[libcxx] shared_ptr changes from library fundamentals (P0414R2)."zoecarver
This reverts commit e8c13c182a562f45287d6b8da612264d09027087.
2020-05-11[libcxx] shared_ptr changes from library fundamentals (P0414R2).zoecarver
Implements P0414R2: * Adds support for array types in std::shared_ptr. * Adds reinterpret_pointer_cast for shared_ptr. Differential Revision: https://reviews.llvm.org/D62259
2019-05-31Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow
Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
2019-02-04Support tests in freestandingJF Bastien
Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
2019-01-19Update more file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
2014-12-20Move test into test/std subdirectory.Eric Fiselier
llvm-svn: 224658