Open 91b604ff-5b4e-4821-a182-129f49d1a44c opened 4 years ago
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
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; }
Hmm. Indeed. Thanks! I'll see what I can do.
assigned to @haoNoQ
Extended Description
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
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; }