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

Fix: dangling reference in the range-based for loop #253

Merged
merged 2 commits into from
Feb 6, 2024

Conversation

SjMxr233
Copy link
Contributor

@SjMxr233 SjMxr233 commented Feb 4, 2024

A dangling reference will apear in the following code:

for(auto view : vkb_swapchain.get_image_views().value()) { //Anything }

Returning an rvalue reference binding the subobject of a tempory object doesn't make any sense.
Please see this for more details.
There is a simple example: https://godbolt.org/z/YcEefWGr7

Copy link
Owner

@charles-lunarg charles-lunarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@charles-lunarg charles-lunarg merged commit eab5179 into charles-lunarg:main Feb 6, 2024
8 checks passed
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