Skip to content

No dangling assignment involving lifetimebound argument #112234

Open
@usx95

Description

@usx95

https://godbolt.org/z/oedcc359z

struct S { int *x; };

S foo(const int &x [[clang::lifetimebound]]);

void usage() {
    S y = foo(1);  // Warning. Good.
    y = foo(1);    // No warning. Bad.
}

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