dascandy / hippomocks

GNU Lesser General Public License v2.1
192 stars 65 forks source link

Bug: clang-tidy "clang-analyzer-core.StackAddressEscape" being triggered #90

Open rianquinn opened 6 years ago

rianquinn commented 6 years ago

When using hippomocks with xxxFunc calls, clang-tidy's clang-analyzer-core.StackAddressEscape check is triggering.

kenfred commented 5 years ago

I have the same issue, but it is tied to MockRepository.

In the function:

void SomeFunc()
{
    MockRepository mocks;
}

I get the following clang-tidy error: Address of stack memory associated with local variable 'mocks' is still referred to by the global variable 'instance' upon returning to the caller. This will be a dangling reference [clang-analyzer-core.StackAddressEscape,-warnings-as-errors]

This would appear to be an issue with clang-tidy, because I find in the destructor of MockRepository that the instance singleton is being cleared.