Skip to content

[clang] False diagnositc for container for pointer with lifetimebound #116066

Open
@usx95

Description

@usx95
#include <optional>
#include <string>
#include <string_view>

template <class T>
struct S {
    T foo(T&& t [[clang::lifetimebound]]);
};

void use() {
    S<std::string_view> s;
    std::string_view x = s.foo(std::optional<std::string_view>{}.value()); // False warning here.
}

cc: @hokein @Xazax-hun

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:memory-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions