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

            Bug ID: 63519
           Summary: missing Wparenthesis warning for x binary_op bool ?:
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org

int foo(bool a, int x, int y, int z)
{
  return x * a ? y : z;
}

Clang:

test.cc:3:16: warning: operator '?:' has lower precedence than '*'; '*' will be
evaluated first [-Wparentheses]
  return x * a ? y : z;
         ~~~~~ ^
test.cc:3:16: note: place parentheses around the '*' expression to silence this
warning
  return x * a ? y : z;
               ^
         (    )
test.cc:3:16: note: place parentheses around the '?:' expression to evaluate it
first
  return x * a ? y : z;
               ^
             (        )

Reply via email to