-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed as not planned
Closed as not planned
Copy link
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issueinvalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug
Description
source code
#include <utility>
template<typename T>
void test(T a) {}
int main() {
std::forward<void(int)>(&test<int>);
return 0;
}clang fails with
<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
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issueinvalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug