view gcc/testsuite/c-c++-common/pr62199-2.c @ 16:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line source

/* PR c++/62199 */
/* { dg-do compile } */
/* { dg-options "-Wlogical-not-parentheses" } */

#ifndef __cplusplus
# define bool _Bool
#endif

bool r;

void
foo (bool b)
{
  r = !b == 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */
  r = !b != 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */
  r = !b > 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */
  r = !b >= 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */
  r = !b < 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */
  r = !b <= 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */
}