https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117410

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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 <typename T = void>
bool foo() { return false; }

template <typename T = void>
bool foo(...) { return true; }

template <int = 0>
bool bar() { return false; }

template <int x = 0>
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.

Reply via email to