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

--- Comment #3 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
I think this bug should be changed to a request to improve the diagnostics.

The diagnostic says:

```
<source>:13:15: note: constraints not satisfied
<source>:8:9:   required by the constraints of 'template<class t> concept foo'
<source>:8:15:   in requirements with 't v' [with t = int]
<source>:10:6: note: 'v' does not satisfy return-type-requirement
   10 |     {v} -> same_as<t>;
      |      ^
```

If you don't know that `{v}` should be read as `{(v)}`, it is confusing that
the diagnostic says that `'t v' [with t = int]` does not satisfy that the type
of the expression `{ v }` is `t`.

I think the diagnostic for the return-type-requirement should add the reason /
diagnostic why it isn't fulfilled, so basically the same reason that
`static_assert(std::same_as<decltype((v)), int>);` would give.

> note: the expression 'is_same_v<_Tp, _Up> [with _Tp = int&; _Up = int]' 
> evaluated to 'false'
>   57 |       concept __same_as = std::is_same_v<_Tp, _Up>;
>      |                           ~~~~~^~~~~~~~~~~~~~~~~~~
  • [Bug c++/94673] [c... arthur.j.odwyer at gmail dot com via Gcc-bugs
    • [Bug c++/9467... gcc-bugs at marehr dot dialup.fu-berlin.de via Gcc-bugs
    • [Bug c++/9467... ppalka at gcc dot gnu.org via Gcc-bugs
    • [Bug c++/9467... gcc-bugs at marehr dot dialup.fu-berlin.de via Gcc-bugs

Reply via email to