[llvm-bugs] [Bug 44003] New: False positive -Wreturn-stack-address warning with optional
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Thu Nov 14 11:33:16 PST 2019
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=44003
            Bug ID: 44003
           Summary: False positive -Wreturn-stack-address warning with
                    optional
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rogero at howzatt.demon.co.uk
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk
The following code, with clang trunk and -std=c++17, produces a warning that I
believe to be a false positive.
---- code ----
#include <optional>
#include <string_view>
std::string_view foo()
{
    std::optional<std::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
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191114/aa3aa151/attachment.html>
    
    
More information about the llvm-bugs
mailing list