[Bug c++/89085] New: call of overload is ambiguous with parameter packs
lumosimann at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 28 08:29:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89085
Bug ID: 89085
Summary: call of overload is ambiguous with parameter packs
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lumosimann at gmail dot com
Target Milestone: ---
The following example behaves differently for GCC and Clang and I am almost
sure that Clang is right, because the second overload is clearly more
specialized:
template <int, typename T, typename... Args>
int a(T const&, Args&&...) {
return 0;
}
template <int, typename... Args>
int a(int const&, Args&&...) {
return 1;
}
int main() { a<1>(3, 1); }
See https://godbolt.org/z/7eRGmW
Note that the issue requires that
1. parts of the function template needs to be specialized when calling
(removing the first template parameter resolved the problem)
2. it requires a parameter pack
Just some further notes:
- When I add another Arg to the first overload (see
https://godbolt.org/z/AF7TeC), gcc compiles and chooses the first overload, and
clang rejects, and again I think that clang is right
- One way how we can do a workaround: https://godbolt.org/z/WmKdL5
More information about the Gcc-bugs
mailing list