Lines beginning with ampersand not being marked as covered

Line beginning with an ampersand (&) that are part of a function are not marked as covered.

Example:

    myvector->push_back(std::make_unique<AUniqueObject>( // green
                    mylogger(), // green
                    value1,    // clear
                    &value2, // red
                    &value3, // red
                    &value4, // red
                    value5)); // green

I have this pattern 3 times in one file and it occurs on each.

If you concatenate the lines, the following happens:

    myvector->push_back(std::make_unique<AUniqueObject>( // green
                    mylogger(), // green
                    value1, &value2, &value3, &value4, // red
                    value5)); // green

But it does reduce my overall uncovered lines total.

Downside the ‘new line’ is not covered and thus my new code total goes down.

Hello @graham.reeds,
What coverage tool are you using?
Do you see the same coverage pattern in your coverage report?

Thanks,

The coverage tool is gcov. It is entirely possible that it is a bug in gcov and not SonarCloud.

Picking out one, this is what gcov gives:

   12:  399:                myvector->push_back(std::make_unique<AUniqueObject>(
    6:  399-block  0
    6:  399-block  1
%%%%%:  399-block  2
%%%%%:  399-block  3
   12:  400                     mylogger(),
%%%%%:  400-block  0
    -:  401:                    value1,  
#####:  402:                    &value2,
%%%%%:  402-block  0
#####:  403:                    &value3,
%%%%%:  403-block  0
    -:  404:                    value4,
    -:  405:                    value5,
    -:  406:                    value6,
    -:  407:                    value7,
    6:  408:                    value8,
    6:  409:                    value9));

@graham.reeds SonarCloud is just displaying the result from gcov. If you see the problem in the report, I recommend to report the issue to the maintainer of gcov.