[Bug c++/117410] Ambiguous overload with variadic arguments
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117410 --- Comment #5 from Artyom Kolpakov --- Here is a slightly different example: template void foo(int = 0) {} template void foo(...) requires true {} int main() { foo(); } The current standard contains ambiguity regarding ellipsis. I suggested opening a new core issue (https://cplusplus.github.io/CWG/issues/2949.html) that can be tracked for this "bug".
[Bug c++/117410] Ambiguous overload with variadic arguments
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117410 --- Comment #4 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #2) > I think the reason GCC rejects the original one is because it's the only > compiler that correctly implements P2113. Clang apparently supports P2113 since version 16.
[Bug c++/117410] Ambiguous overload with variadic arguments
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117410 --- Comment #3 from Artyom Kolpakov --- (In reply to Jonathan Wakely from comment #2) > But without the variadic arguments, the functions have equivalent function > parameter lists, so the constraints are checked. With the ellipsis, they do > not have equivalent function parameter lists, so the constraints are ignored. I could not find any mention in the standard of how exactly length of function parameter list is determined. It is unclear whether and how an ellipsis or a function parameter pack are included in this length ([dcl.fct#4]). It is also unclear which parameter list is mentioned in [temp.func.order#6.1]. Is this a new core Issue?
[Bug c++/117410] Ambiguous overload with variadic arguments
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117410 --- Comment #2 from Jonathan Wakely --- But without the variadic arguments, the functions have equivalent function parameter lists, so the constraints are checked. With the ellipsis, they do not have equivalent function parameter lists, so the constraints are ignored. That was specified by https://wg21.link/P2113 and implemented by r11-1571-g57b4daf8dc4ed7 Since the constraints are not checked, we can remove them without changing the meaning of the program: template bool foo() { return false; } template bool foo(...) { return true; } template bool bar() { return false; } template bool bar(...) { return true; } int main() { (foo()); (bar()); } All compilers agree that this is ambiguous. I think the reason GCC rejects the original one is because it's the only compiler that correctly implements P2113.