[Bug c++/79504] New: Mix of perfect forwarding and reference qualifier leads to recursive template instantiation.
Predelnik at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 14 08:58:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79504
Bug ID: 79504
Summary: Mix of perfect forwarding and reference qualifier
leads to recursive template instantiation.
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Predelnik at gmail dot com
Target Milestone: ---
The following example seems correct to me and is accepted by msvc/clang but gcc
rejects it starting from version 4.8 up to current day versions with "template
instantiation depth exceeds maximum of 900". Removing trailing type helps, so
it's gotta be problem with f in trailing type being the wrong one I guess.
#include <utility>
struct A
{
void f () & {}
template <typename ...Args> auto f (Args &&... args) && -> decltype
(std::move (this->f (std::forward<Args> (args)...)))
{
return std::move (this->f (std::forward<Args> (args)...));
}
};
int main (){
A p;
p.f ();
}
More information about the Gcc-bugs
mailing list