<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [concepts] What is the return type of local parameters of requires expressions?"
   href="https://bugs.llvm.org/show_bug.cgi?id=45622">45622</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[concepts] What is the return type of local parameters of requires expressions?
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++2a
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>llvm@marehr.dialup.fu-berlin.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 &>);
```

<a href="https://godbolt.org/z/MGpfZF">https://godbolt.org/z/MGpfZF</a>

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.

<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94673">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94673</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>