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

            Bug ID: 47424
           Summary: false-positive [clang-analyzer-deadcode.DeadStores]
                    with reference
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcough...@apple.com
          Reporter: tiagomacar...@gmail.com
                CC: dcough...@apple.com, llvm-bugs@lists.llvm.org

With the following code [clang-analyzer-deadcode.DeadStores] will report
'b=true' as never read, but ~S() will read it. 

https://godbolt.org/z/dqfrc1

#include <iostream>

struct S {
  const bool& m_b;
  S(bool const& b) : m_b(b) {}
  ~S() { std::cout << m_b; }
};

int main() {
  bool b = false;
  S s(b);
  b = true;
}

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

Reply via email to