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

Wang Jinghao <zheng.xianyuwang at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zheng.xianyuwang at gmail dot 
com

--- Comment #1 from Wang Jinghao <zheng.xianyuwang at gmail dot com> ---
The first diagnostic is emitted in finish_id_expression, while the
second comes from rebuild_postconditions -> tsubst_expr; that is,
the error is diagnosed once during the initial parsing of the
expression and again when the type of `r' is substituted during
pseudo-instantiation.

Perhaps we should make `check_param_in_postcondition` return a `bool`,
and have `finish_id_expression` return `error_mark_node` when that
check fails.

BTW, since rebuild_postconditions skips function templates, the
following example also produces the diagnostic twice in 16.2, whereas
trunk does not.

```
template<typename>
  int f(int v) post(r : v == r) { return v; }
```

Reply via email to