https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93415
Bug ID: 93415 Summary: Previous declaration of template without default arguments leads to incorrect overload resolution Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Predelnik at gmail dot com Target Milestone: --- #include <iostream> template <bool B> void f (int); template <bool B = true> void f (int) { std::cout << "correct - int\n"; } template <bool B = true> void f (char) { std::cout << "wrong - char\n"; } int main () { f (0); return 0; } The above program prints "wrong - char" with gcc, however just removing declartion of `f` without default arguments leads to expected result. It is very annoying issue because do-nothing forward declarations may lead to unexpected hard to find bugs. Other compilers seem to handle this case properly.