https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95511
Bug ID: 95511
Summary: Class template argument deduction: guide generated
from constructor preferred over deduction-guide.
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: okannen at gmail dot com
Target Milestone: ---
This bug exists since gcc 7 and all following version. It also exists on the
current GCC-10 release branch.
The following code should compile:
template <class...Ts>
struct tpl
{
tpl (Ts...);
};
template <class...Ts>
struct A
: tpl <Ts...>
{
template <class...Args>
A (Args...args)
: tpl <Ts...> (args...)
{}
};
template <class...Ts>
A (Ts...) -> A <Ts...>;
A a {10}; //error: no matching function for call to 'tpl<>::tpl(int&)'
Clang compile this code.
Maybe overload resolution considers that the guide generated from the
constructor of A is a better match than the one generated from the
deduction-guide.