forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++] LWG3223 Broken requirements for shared_ptr converting constr…
…uctors (llvm#93071)
- Loading branch information
Showing
7 changed files
with
113 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...td/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/types.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef TEST_STD_UTILITIES_MEMORY_UTIL_SMARTPTR_SHARED_CONST_TYPES_H | ||
#define TEST_STD_UTILITIES_MEMORY_UTIL_SMARTPTR_SHARED_CONST_TYPES_H | ||
|
||
#include <type_traits> | ||
|
||
struct bad_ty {}; | ||
|
||
struct bad_deleter { | ||
void operator()(bad_ty) {} | ||
}; | ||
|
||
struct no_move_deleter { | ||
no_move_deleter(no_move_deleter const&) = delete; | ||
no_move_deleter(no_move_deleter&&) = delete; | ||
void operator()(int*) {} | ||
}; | ||
|
||
static_assert(!std::is_move_constructible<no_move_deleter>::value, ""); | ||
|
||
struct no_nullptr_deleter { | ||
void operator()(int*) const {} | ||
void operator()(std::nullptr_t) const = delete; | ||
}; | ||
|
||
struct Base {}; | ||
struct Derived : Base {}; | ||
|
||
template <class T> | ||
class MoveDeleter { | ||
MoveDeleter(); | ||
MoveDeleter(MoveDeleter const&); | ||
|
||
public: | ||
MoveDeleter(MoveDeleter&&) {} | ||
|
||
explicit MoveDeleter(int) {} | ||
|
||
void operator()(T* ptr) { delete ptr; } | ||
}; | ||
|
||
#endif // TEST_STD_UTILITIES_MEMORY_UTIL_SMARTPTR_SHARED_CONST_TYPES_H |