Skip to content

clang-analyzer-cplusplus.NewDeleteLeaks incorrectly reports leak #54481

@sam1018

Description

@sam1018

For the following code:

std::shared_ptr create_sp() { return std::make_shared(10); }

std::vector<std::shared_ptr> f() { return {create_sp()}; }

clang-analyzer is incorrectly raising NewDeleteLeaks warning. happens with-std=c++17 flag. Here is godbolt link showing the issue: https://godbolt.org/z/K88K86xrG

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions