[llvm-bugs] [Bug 48011] New: range-loop-analysis checks for trivial copyability, rather than trivial copy-constructibility

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 29 09:40:52 PDT 2020


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

            Bug ID: 48011
           Summary: range-loop-analysis checks for trivial copyability,
                    rather than trivial copy-constructibility
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: jake.arkinstall at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

On the Cpplang slack, user Wolle posted a curious warning that came from
range-loop-analysis.

Here's a minimal example: https://godbolt.org/z/1cxs43. Note that without the
copy assignment operator overload, the warning is not present.

The range-based for loop performs a copy construction, so that is what should
be checked for.

At https://clang.llvm.org/doxygen/SemaStmt_8cpp_source.html#l02824, the check
is on whether the type is trivially copyable, not whether it is trivially copy
constructible, which is a weaker requirement (but the relevant one in this
case). I am not intimately familiar with clang sourcecode, but I believe this
to be the cause of the warning.

-- 
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/20201029/08ab3bb2/attachment.html>


More information about the llvm-bugs mailing list