Issue |
101614
|
Summary |
[Clang] libstdc++’s `std::forward_like` doesn’t compile
|
Labels |
clang:frontend,
c++23,
libstdc++
|
Assignees |
|
Reporter |
Sirraide
|
Attempting to use libstdc++’s implementation of `std::forward_like` (https://godbolt.org/z/cGK1bsjzM)
```c++
#include <utility>
void f() {
(void) std::forward_like<int&&>(1);
}
```
results in this error
```
<source>:4:17: error: function 'forward_like<int &&, int>' with deduced return type cannot be used before it is defined
4 | (void) std::forward_like<int&&>(1);
| ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/bits/move.h:93:3: note: 'forward_like<int &&, int>' declared here
93 | forward_like(_Up&& __x) noexcept
| ^
```
whereas the same code compiles just fine if `libc++` is used. GCC of course compiles this just fine with `libstdc++`.
I haven’t looked into this too much, but it might have something to do with the fact that we treat `std::forward_like` as a builtin, and libstdc++’s declaration uses `decltype(auto)` as the return type of `std::forward_like`, which might be confusing us somehow.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs