<div>$ cat test.cpp</div><div>#define MY_ASSERT(cond) ((cond)? (void)0 : (void)1)</div><div>#define BUG(description) MY_ASSERT(!description)</div><div><br></div><div>void foo (int some_condition)</div><div>{</div><div>  if (some_condition)</div><div>    BUG("oh this is broken");</div><div>}</div><div>$ clang -Werror -Wstring-conversion -c test.cpp</div><div>test.cpp:7:9: error: implicit conversion turns string literal into bool:</div><div>      'const char [18]' to 'bool' [-Werror,-Wstring-conversion]</div><div>    BUG("oh this is broken");</div><div>    ~~~~^~~~~~~~~~~~~~~~~~~~</div><div>test.cpp:2:37: note: expanded from macro 'BUG'</div><div>#define BUG(description) MY_ASSERT(!description)</div><div>                                    ^</div><div>test.cpp:1:27: note: expanded from macro 'MY_ASSERT'</div><div>#define MY_ASSERT(cond) ((cond)? (void)0 : (void)1)</div><div>                          ^</div><div>1 error generated.</div><br><div class="gmail_quote">On Mon Nov 17 2014 at 9:01:09 PM jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Nov 17, 2014, at 7:18 AM, Timur Iskhodzhanov <<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>> wrote:</div><br><div>Hi,<br><br>This has broken our -Werror internal build.<div>One specific thing that I consider a [noisy] false positive:</div><div><br></div><div>#define MY_ASSERT(cond) ((cond)? (void)0 : blah)</div><div>#define BUG(description) MY_ASSERT(!description)</div><div>...</div><div>if (some_condition)</div><div>  BUG("oh this is broken")<br></div></div></blockquote></div><br><div><br></div></div><div style="word-wrap:break-word"><div>I cannot reproduce this warning. This is the test I used:</div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo">#define MY_ASSERT(cond) ((cond)? (void)0 : (void)1)</div><div style="margin:0px;font-size:11px;font-family:Menlo">#define BUG(description) MY_ASSERT(!description)</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">void foo (int some_condition)</div><div style="margin:0px;font-size:11px;font-family:Menlo">{</div><div style="margin:0px;font-size:11px;font-family:Menlo">  if (some_condition)</div><div style="margin:0px;font-size:11px;font-family:Menlo">    BUG("oh this is broken");</div><div style="margin:0px;font-size:11px;font-family:Menlo">}</div></div><div style="margin:0px;font-size:11px;font-family:Menlo"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">Can you give a test case producing the warning?</div><div style="margin:0px;font-size:11px;font-family:Menlo"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">- Fariborz</div><div style="margin:0px;font-size:11px;font-family:Menlo"><br></div></div></blockquote></div>