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

            Bug ID: 95344
           Summary: Wparentheses (assignment used as truth value) on
                    parenthesized ternary conditional E2
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

void f(int i) {
    bool b = false;
    if (i == 99 ? (b = true) : false)
        ;
}

warning: suggest parentheses around assignment used as truth value
[-Wparentheses]
    3 |     if (i == 99 ? (b = true) : false)
      |                  ~~~^~~~~~~

Per Godbolt, issue exists from 9.1 through current trunk (11.0).

Reply via email to