https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86879

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2018-08-07 00:00:00         |2021-4-8

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
No progress in GCC 11.

Clang issues -Wpointer-bool-conversion and -Wundefined-bool-conversion:

 cat pr86879.C && clang -S -Wall pr86879.C
void* get() __attribute__((returns_nonnull));

int f() { return get() ? 0 : 1; }

int& ref();

int g()
{
  return &ref() ? 0 : 1;
}
pr86879.C:3:18: warning: nonnull function call 'get()' will evaluate to 'true'
      on first encounter [-Wpointer-bool-conversion]
int f() { return get() ? 0 : 1; }
                 ^~~~~ ~
pr86879.C:1:28: note: declared 'returns_nonnull' here
void* get() __attribute__((returns_nonnull));
                           ^
pr86879.C:9:11: warning: reference cannot be bound to dereferenced null pointer
      in well-defined C++ code; pointer may be assumed to always convert to
true
      [-Wundefined-bool-conversion]
  return &ref() ? 0 : 1;
          ^~~~~ ~
pr86879.C:5:6: note: 'ref' returns a reference
int& ref();
     ^
2 warnings generated.

Reply via email to