https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88252
Bug ID: 88252
Summary: Deduction guide assume the constructor parameter is a
forwarding reference if constructor defined outside
class
Product: gcc
Version: 8.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: okannen at gmail dot com
Target Milestone: ---
Constructor parameter that have the forms of a forwarding reference (T&&)
inside a constructor are not forwarding reference if T is a parameter of the
class template. But gcc assumes it is a forwarding reference if the constructor
is defined outside the class:
template<typename T>
struct B1 {
B1(T&& x){}
};
template<typename T>
struct B2 {
B2(T&& x) ;
};
template<typename T>
B2<T>::B2(T&& x){}
int i;
B1 a{i};//Expect: compilation error, class template argument deduction failed
B2 b{i};//Unexpected: no compilation error.