title: lcov reports that line in static member variables destructor is not executed
body: <p>I have a struct which contains a static member variable. One of the lines in the destructor of this member variable is allegedly never executed, this is reported by lcov. This one line should only be executed when the program terminates. So I guess its just lcov that isn't able to count it. Valgrind can reveal that the line is of course executed as expected. </p>
  
  <p>Is it possible to have lcov count this line?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;cstdint&gt; // uintX_t
  #include &lt;map&gt;     // std::map
  #include &lt;deque&gt;   // std::deque
  
  struct foo
  {
      struct bar
      {
          uint8_t* p;
  
          bar(uint8_t* const p_in) : p(p_in) {}
          ~bar()
          {
              if (p != nullptr)
              {
                  delete[] p; // This line is allegedly never executed, reported by lcov
              }
          }
  
          bar(const bar&amp;) = delete;
          bar&amp; operator=(const bar&amp;) = delete;
  
          uint8_t* get_p()
          {
              uint8_t* const tmp = p;
              p = nullptr;
              return tmp;
          }
      };
  
      static std::map&lt;uint64_t, std::deque&lt;bar&gt;&gt; storage;
  
      const uint32_t N;
      uint8_t* P;
  
      foo(const uint32_t n) : N(n)
      {
          if (storage[N].size() == 0)
          {
              P = new uint8_t[N];
          }
          else
          {
              uint8_t* const p = storage[N].back().get_p();
              storage[N].pop_back();
              P = p;
          }
      }
  
      ~foo()
      {
          storage[N].emplace_back(P);
      }
  };
  
  std::map&lt;uint64_t, std::deque&lt;typename foo::bar&gt;&gt; foo::storage;
  
  int main()
  {
      for (int i = 0; i &lt; 2; ++i)
      {
          foo a(3);
          foo b(3);
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/fWodK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fWodK.png" alt="lcov results"></a></p>