Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared_ptr's converting ctor from unique_ptr is incorrectly constrained. #31495

Closed
llvmbot opened this issue Mar 6, 2017 · 2 comments
Closed
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 6, 2017

Bugzilla Link 32147
Resolution FIXED
Resolved on Apr 08, 2021 22:12
Version unspecified
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @mclow,@zoecarver

Extended Description

Libc++ incorrectly rejects the following code.

Reproducer from stack overflow:

// clang++ -std=c++14 test.cpp
#include

int main() {
auto up = std::unique_ptr<int[]>(new int[5]{});
auto sp = std::shared_ptr(std::move(up));
}

I'm not yet 100% sure this is the behavior required be the C++17 standard, but It needs to be investigated and libc++ is most likely wrong.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Mar 6, 2017

So both C++11 and C++14 seem to allow this, but it appears to be forbidden in C++17 after applying p0414r2.

@zoecarver
Copy link
Contributor

Fixed by https://reviews.llvm.org/D80882.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

2 participants