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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to