Skip to content

__attribute__((lifetimebound)) cannot be applied on the implicit "this" parameter #121905

Open
@hokein

Description

@hokein

See https://godbolt.org/z/KdGEfdG4r


struct Foo2 {
  int& get1() [[clang::lifetimebound]];  // good
  int& get2() __attribute__((lifetimebound)); // bad

  const int& get3(const int& a __attribute__((lifetimebound))); // good
};


void s() {
  Foo2 f;
  const int &b = f.get3(1);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang: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