The following program makes the pointer x on function g<void>() having automatically deduced return type:
template<class=void>
void g() {}
int main() {
auto (*x)() = &g;
(*x)();
}
The program is accepted by GCC, but rejected in Clang with the error:
error: variable 'x' with type 'auto (*)()' has incompatible initializer of type '<overloaded function type>'
auto (*x)() = &g;
Demo: https://gcc.godbolt.org/z/s17Mf74Wc
Which compiler is right here?