Closed
Description
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_);
}
with
gcc-7.1 -Wall -c ./gtest-ambiguous-else-warning.cpp
The printout would be
./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.
Metadata
Metadata
Assignees
Labels
No labels