Shouldn't we really have ASSERT_EQ( 2, errorCount() )? If errorCount() is 1 then this will execute and it will try to get errorCount[2] and segfault as an errorCount() of 1 satisfies the ASSERT and EXPECT will not break the flow.