[llvm-bugs] [Bug 49628] New: Static analyzer false positive InnerPointer with std::data() from C++17

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 18 07:24:57 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49628

            Bug ID: 49628
           Summary: Static analyzer false positive InnerPointer with
                    std::data() from C++17
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: dmjpp at hotmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

The following C++17 code falsely triggers InnerPointer.

#include <string>

int main()
{
    auto s = std::string("abc");
    auto p = data(s);     // this triggers the warning
    // auto p = s.data(); // this is OK
    p[1] = 'Z';
}

std::data() is a very simple addition to C++17,
https://en.cppreference.com/w/cpp/iterator/data

-- 
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/20210318/33ea29d6/attachment.html>


More information about the llvm-bugs mailing list