Despite writing
- this answer(google mock - can I call EXPECT_CALL multiple times on same mock object?)
- this answer (Interleaving EXPECT_CALL()s and calls to the mock functions)
- and this issue (Is interleaving
EXPECT_CALL()
s and calls to the mock function really undefined behavior?)
...I still don't know why Google says this is undefined behavior:
...otherwise the behavior is undefined. In particular, you mustn't interleave EXPECT_CALL()s and calls to the mock functions" (https://github.com/google/googletest/blob/master/googlemock/docs/for_dummies.md#using-mocks-in-tests)
They simply glossed over my issue above, restating it was in fact undefined behavior, but without explaining why.
Can anyone explain the details of why and how it is undefined behavior?