You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting from gcc 7.1 the GTEST_ASSERT_ and all the dependencies produce the following warning,
when used with if statement without surrounding braces.
It seems GTEST_AMBIGUOUS_ELSE_BLOCKER_ does not do the trick any more.
To reproduce, compile the following code
// gtest-ambiguous-else-warning.cpp
#include "gtest/gtest.h"
void foo(int i) {
if (i > 0)
GTEST_ASSERT_(::testing::AssertionFailure(), GTEST_NONFATAL_FAILURE_);
}
./gtest-ambiguous-else-warning.cpp: In function 'void foo(int)':
./gtest-ambiguous-else-warning:4:6: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
if (i > 0)
^
We observe the issue with Google Test 1.8.0, but as far as I can tell, it is the same in the current trunk.