[llvm-bugs] [Bug 45622] New: [concepts] What is the return type of local parameters of requires expressions?
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Apr 20 10:42:28 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: llvm at marehr.dialup.fu-berlin.de
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200420/537b58e5/attachment.html>
More information about the llvm-bugs
mailing list