[Bug c++/94673] [concepts] What is the return type of local parameters of requires expressions?

gcc-bugs at marehr dot dialup.fu-berlin.de gcc-bugzilla@gcc.gnu.org
Mon Apr 20 17:43:34 GMT 2020


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

--- Comment #1 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
After playing with this a bit more, I found out that clang actually behaves
differently:

```c++
#include <utility>
#include <type_traits>

template <typename t, typename u>
concept same_as = std::is_same_v<t, u>;

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

// all of them work with gcc and msvc
static_assert(foo<int>); // fails with clang
static_assert(foo<int const>); // fails with clang
static_assert(foo<int &&>); // fails with clang
static_assert(foo<int &>);
static_assert(foo<int const &>);
```

https://godbolt.org/z/MGpfZF

I created an issue at https://bugs.llvm.org/show_bug.cgi?id=45622


More information about the Gcc-bugs mailing list