<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/122072>122072</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang++][frontend] clang++ can't treat `&` in `std::forward<void(int)>(&test<int>);` like g++
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          eastB233
      </td>
    </tr>
</table>

<pre>
    source code
```c++
#include <utility>

template<typename T>
void test(T a) {}

int main() {
  std::forward<void(int)>(&test<int>);
  return 0;
}
```

clang fails with
```console
<source>:7:3: error: no matching function for call to 'forward'
    7 | std::forward<void(int)>(&test<int>);
      | ^~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/12.2.0/../../../../aarch64-unknown-linux-gnu/include/c++/12.2.0/bits/move.h:77:5: note: candidate function template not viable: no overload of 'test' matching 'typename std::remove_reference<void (int)>::type &' (aka 'void (&)(int)') for 1st argument
   77 |     forward(typename std::remove_reference<_Tp>::type& __t) noexcept
      |     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/arm64/gcc-12.2.0/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/12.2.0/../../../../aarch64-unknown-linux-gnu/include/c++/12.2.0/bits/move.h:89:5: note: candidate function template not viable: no overload of 'test' matching 'typename std::remove_reference<void (int)>::type &&' (aka 'void (&&)(int)') for 1st argument
   89 |     forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
      |     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
https://godbolt.org/z/fTGz1PMfs

But gcc is okay
https://godbolt.org/z/d3971PWWM
</pre>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