Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hokein opened this issue Jan 7, 2025 · 0 comments
Labels
clang:memory-safety Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)

Comments

@hokein
Copy link
Collaborator

hokein commented Jan 7, 2025

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);
}
@hokein hokein added the clang:memory-safety Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr) label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:memory-safety Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Projects
None yet
Development

No branches or pull requests

1 participant