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

Returning address of variable copied into lambda produces spurious warning. #17748

Open
llvmbot opened this issue Sep 26, 2013 · 0 comments
Open

Returning address of variable copied into lambda produces spurious warning. #17748

llvmbot opened this issue Sep 26, 2013 · 0 comments
Labels
bugzilla c++11

Comments

@llvmbot
Copy link
Collaborator

@llvmbot llvmbot commented Sep 26, 2013

Bugzilla Link 17374
Version 3.2
OS All
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

Given the following sample code:

int main()
{
int i;
auto f = =mutable->int*
{
return &i;
};

return 0;

}

The compiler reports "address of stack memory associated with local variable 'i' returned" for the 'i' in the lambda. That warning would be legitimate for a plain function but not for a lambda.

Note that this bug appears similar to bug #​16548 but it is not the same. Here, the variable is captured by value rather than by reference.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla c++11
Projects
None yet
Development

No branches or pull requests

1 participant