title: What is the branch in the destructor reported by gcov?
body: <p>When I use gcov to measure test coverage of C++ code it reports branches in destructors. </p>
  
  <pre><code>struct Foo
  {
      virtual ~Foo()
      {
      }
  };
  
  int main (int argc, char* argv[])
  {
      Foo f;
  }
  </code></pre>
  
  <p>When I run gcov with branch probabilities enabled (-b) I get the following output.</p>
  
  <pre><code>$ gcov /home/epronk/src/lcov-1.9/example/example.gcda -o /home/epronk/src/lcov-1.9/example -b
  File 'example.cpp'
  Lines executed:100.00% of 6
  Branches executed:100.00% of 2
  Taken at least once:50.00% of 2
  Calls executed:40.00% of 5
  example.cpp:creating 'example.cpp.gcov'
  </code></pre>
  
  <p>The part that bothers me is the "Taken at least once:50.00% of 2".</p>
  
  <p>The generated .gcov file gives more detail.</p>
  
  <pre><code>$ cat example.cpp.gcov | c++filt
          -:    0:Source:example.cpp
          -:    0:Graph:/home/epronk/src/lcov-1.9/example/example.gcno
          -:    0:Data:/home/epronk/src/lcov-1.9/example/example.gcda
          -:    0:Runs:1
          -:    0:Programs:1
          -:    1:struct Foo
  function Foo::Foo() called 1 returned 100% blocks executed 100%
          1:    2:{
  function Foo::~Foo() called 1 returned 100% blocks executed 75%
  function Foo::~Foo() called 0 returned 0% blocks executed 0%
          1:    3:    virtual ~Foo()
          1:    4:    {
          1:    5:    }
  branch  0 taken 0% (fallthrough)
  branch  1 taken 100%
  call    2 never executed
  call    3 never executed
  call    4 never executed
          -:    6:};
          -:    7:
  function main called 1 returned 100% blocks executed 100%
          1:    8:int main (int argc, char* argv[])
          -:    9:{
          1:   10:    Foo f;
  call    0 returned 100%
  call    1 returned 100%
          -:   11:}
  </code></pre>
  
  <p>Notice the line "branch  0 taken 0% (fallthrough)".</p>
  
  <p>What causes this branch and what do I need to do in the code to get a 100% here?</p>
  
  <ul>
  <li>g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2</li>
  <li>gcov (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2</li>
  </ul>