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

False positive -Wreturn-stack-address warning with optional #43348

Closed
rogerorr mannequin opened this issue Nov 14, 2019 · 2 comments
Closed

False positive -Wreturn-stack-address warning with optional #43348

rogerorr mannequin opened this issue Nov 14, 2019 · 2 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@rogerorr
Copy link
Mannequin

rogerorr mannequin commented Nov 14, 2019

Bugzilla Link 44003
Resolution FIXED
Resolved on Feb 19, 2020 06:30
Version trunk
OS Windows NT
CC @dwblaikie,@DougGregor,@zygoloid

Extended Description

The following code, with clang trunk and -std=c++17, produces a warning that I believe to be a false positive.

---- code ----
#include
#include <string_view>

std::string_view foo()
{
std::optionalstd::string_view sv("abc");
return *sv; // unwanted [-Wreturn-stack-address] warning
}
---- code ----

See https://godbolt.org/z/vTs3Kk

This is a regression since clang 9.0

@rogerorr
Copy link
Mannequin Author

rogerorr mannequin commented Feb 19, 2020

Re-checking this issue I find that the reproducing test case is now fixed on gcc-trunk.

(Tested with the godbolt link in the original comment on 2020-02-19)

I have marked this particular issue with -Wreturn-stack-address as resolved

@rogerorr
Copy link
Mannequin Author

rogerorr mannequin commented Feb 19, 2020

s/gcc-trunk/clang-trunk/
(Still recovering from WG21 in Prague)

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

No branches or pull requests

0 participants