llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.81k stars 11.91k forks source link

false-positive [clang-analyzer-deadcode.DeadStores] with reference #46768

Open 91b604ff-5b4e-4821-a182-129f49d1a44c opened 4 years ago

91b604ff-5b4e-4821-a182-129f49d1a44c commented 4 years ago
Bugzilla Link 47424
Version trunk
OS Windows NT
CC @devincoughlin,@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; }

haoNoQ commented 4 years ago

Hmm. Indeed. Thanks! I'll see what I can do.

91b604ff-5b4e-4821-a182-129f49d1a44c commented 4 years ago

assigned to @haoNoQ