Skip to content

-Wreturn-stack-address false positive #120206

@hokein

Description

@hokein

https://gcc.godbolt.org/z/aMzvxerna

struct [[gsl::Pointer]] view {};
struct S {
    view s;
};
struct [[gsl::Owner]] Q {
    const S* get() const [[clang::lifetimebound]];
};
view g(view b, int c) {
    return c > 1 ? Q().get()->s : b;
}

Metadata

Metadata

Assignees

Labels

clang:memory-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)false-positiveWarning fires when it should not

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions