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

Don't warn on lifetime_capture annotated method if the class object is a temporary object. #117728

Closed
hokein opened this issue Nov 26, 2024 · 1 comment
Assignees
Labels
clang:memory-safety Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr) question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@hokein
Copy link
Collaborator

hokein commented Nov 26, 2024

Example:

struct T{
 void set(const int& t [[clang::lifetime_capture_by(this)]]);
};

void s() {
    T().set(1); // we should not warn on this case.
}
@hokein hokein added the clang:memory-safety Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr) label Nov 26, 2024
@hokein hokein self-assigned this Nov 26, 2024
@hokein
Copy link
Collaborator Author

hokein commented Nov 28, 2024

As discussed, this is an expected behavior, see #117733.

@hokein hokein closed this as completed Nov 28, 2024
@EugeneZelenko EugeneZelenko added the question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! label Nov 28, 2024
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) question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

2 participants