Following code can't be compiled with g++ version 5.4.0 with option -std=c++1y
:
void f(int=0) ;
int main() {
f(); // ok
(*f)(2);// ok
(*f)();// ok c++11; error with c++14: too few arguments to function
return 0;
}
The function declared to have default argument, so what is wrong here? thanks for help.
And why does g++ -c -std=c++11
compile?
g++
version. The 5 line is old, and 5.4 isn't even its newest minor release. It's also prudent to search the GCC Bugzilla in cases like this, as the issue is probably already known, but filtering through to older versions can take a while and sometimes just doesn't happen. – Poser