GCC Code Coverage Report


Directory: .
File: main.cpp
Date: 2025-09-27 21:24:05+00:00
Coverage Exec Excl Total
Lines: 100.0% 17 0 17
Functions: 100.0% 5 0 5
Branches: 50.0% 3 0 6

Line Branch Exec Source
1 #include <iostream>
2
3 class Bar
4 {
5 public:
6 6 Bar() : m_bar(1)
7 6 {}
8 4 virtual ~Bar()
9 4 {} // possible compiler-generated destruction code - auto-detected and excluded
10
11 1 void foo() const
12 {
13 1 std::cout << "Const " << this->m_bar << std::endl;
14 1 }
15 1 void foo()
16 {
17 1 std::cout << "Non const " << this->m_bar << std::endl;
18 1 }
19
20 private:
21 int m_bar;
22 };
23
24 1 int main(int argc, char* argv[]) {
25 1 Bar bar;
26
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 const Bar const_bar;
27
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 bar.foo();
28
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 const_bar.foo();
29
30 1 return 0;
31 1 }
32