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

            Bug ID: 126898
           Summary: [contracts] Postconditions incorrectly treat
                    parameters in the left operand of a comma expression
                    as ODR-used
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: c++-contracts, c++26, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zheng.xianyuwang at gmail dot com
  Target Milestone: ---

Consider the following example:

```
void f (bool b)
  post ((b, true))
{}
```

In the comma expression `(b, true)', the left operand `b' is a discarded-value
expression. Since a has non-volatile scalar type, no lvalue-to-rvalue
conversion is applied to it, so this use does not constitute an ODR-use.

Similar to the example in https://eel.is/c++draft/basic.def.odr#5.2.2.2:
```
int x, y;
int _ = ((cond ? x : y), 0);  // does not odr-use x or y
```

Reply via email to