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

            Bug ID: 27562
           Summary: Warn if a value that's been std::move()d from is
                    accessed
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: nicolaswe...@gmx.de
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

Spot the bug:

  auto insertion_result = allocator_dumps_.insert(
      std::make_pair(mad->absolute_name(), std::move(mad)));
  DCHECK(insertion_result.second) << "Duplicate name: " <<
mad->absolute_name();     


mad is move()d from in the first statement but then accessed in the second.
This is probably almost always a bug. We should warn on it. (I couldn't find an
existing bug for this.)

Maybe this could work similar to -Wuninitialized where we conceptually treat
things that have been move()d from as uninitialized from that point on.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to