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

modernize-make-unique check doesn't apply to unique_ptr.reset() #27757

Closed
pepsiman opened this issue Apr 16, 2016 · 2 comments
Closed

modernize-make-unique check doesn't apply to unique_ptr.reset() #27757

pepsiman opened this issue Apr 16, 2016 · 2 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang-tidy

Comments

@pepsiman
Copy link
Contributor

Bugzilla Link 27383
Resolution FIXED
Resolved on Nov 01, 2016 05:06
Version unspecified
OS All

Extended Description

$ cat makeuniquetest.cpp
#include
int main()
{
auto p = std::unique_ptr{new int()};
p.reset(new int());
}

clang-tidy warns about line 4, but not line 5:

$ clang-tidy makeuniquetest.cpp -checks=-*,modernize-make-unique -- -std=c++14
1 warning generated.
/makeuniquetest.cpp:4:14: warning: use std::make_unique instead [modernize-make-unique]
auto p = std::unique_ptr{new int()};
^
std::make_unique ( )

Expected result after applying fixes:

#include
int main()
{
auto p = std::make_unique();
p = std::make_unique();
}

@pepsiman
Copy link
Contributor Author

assigned to @pepsiman

@pepsiman
Copy link
Contributor Author

pepsiman commented Nov 1, 2016

Fixed in https://reviews.llvm.org/rL285589

@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 clang-tidy
Projects
None yet
Development

No branches or pull requests

1 participant