Skip to content

Add lifetimebound attribute#77

Merged
patrickroberts merged 1 commit into
mainfrom
lifetimebound
Jun 9, 2026
Merged

Add lifetimebound attribute#77
patrickroberts merged 1 commit into
mainfrom
lifetimebound

Conversation

@patrickroberts

Copy link
Copy Markdown
Collaborator

Here's the motivating case:

any_view<int> foo() {
    vector<int> vec;
    // return {vec};  // not ok, reference dangles
    return vec;  // ok, NRVO moves
}

Getting this return statement correct is subtle and error-prone, and the lifetimebound attribute helps catch dangling references as compilation errors.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 81.25%. remained the same — lifetimebound into main

@patrickroberts patrickroberts merged commit dfba413 into main Jun 9, 2026
78 checks passed
@patrickroberts patrickroberts deleted the lifetimebound branch June 9, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants