https://bugs.llvm.org/show_bug.cgi?id=45622

            Bug ID: 45622
           Summary: [concepts] What is the return type of local parameters
                    of requires expressions?
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangb...@nondot.org
          Reporter: l...@marehr.dialup.fu-berlin.de
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

What should I expect when I write the following concept:

```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

gcc and msvc accept theses cases. Are they wrong, or is clang wrong in this
regard?

I created a bug at gcc. After playing with my original example a bit more, I
found out that it seems that clang behaves differently.

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to