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

gcc-bugs at marehr dot dialup.fu-berlin.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
(In reply to Patrick Palka from comment #4)
> Don't we already do this with -fconcepts-diagnostics-depth=2 ?

You are right, sorry! Haven't checked that again thoroughly, and it seems that
you do. 

> -fconcepts-diagnostics-depth=2

will produce

```
<source>:18:15: error: static assertion failed
   18 | static_assert(foo<int &&>); // fails with clang
      |               ^~~~~~~~~~~
<source>:18:15: note: constraints not satisfied
<source>:9:9:   required by the constraints of 'template<class t> concept foo'
<source>:9:15:   in requirements with 't v' [with t = int&&]
<source>:11:6: note: 'v' does not satisfy return-type-requirement, because
   11 |     {v} -> std::same_as<t &>;
      |     ~^~~~~~~~~~~~~~~~~~~~~~~
<source>:11:6: error: deduced expression type does not satisfy placeholder
constraints
<source>:11:6: note: constraints not satisfied
In file included from
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/compare:39,
                 from
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/bits/stl_pair.h:65,
                 from
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/utility:70,
                 from <source>:1:
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/concepts:57:15:   required
for the satisfaction of '__same_as<_Tp, _Up>' [with _Tp = int&&; _Up = int&]
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/concepts:62:13:   required
for the satisfaction of 'same_as<decltype(auto) [requires
std::same_as<<placeholder>, t&>], t&>' [with decltype(auto) [requires
std::same_as<<placeholder>, t&>] = int&&; t = int&&]
/opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/concepts:57:32: 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>;
      |             
```

It seems that the behaviour changed again in gcc-11:

```
template <typename t>
concept foo = requires(t v)
{
    {v} -> same_as<t &>;
};

static_assert(foo<int &&>); // true in gcc-10, false in gcc-11
```

Thank you again, from my POV can be closed.
  • [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