https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97999
--- Comment #1 from spartan_117 at juno dot com --- Adding a statement before the call that simply takes the address of the inner function template instance results in successful compilation. For example: template <typename type> static auto yolo(type) {} auto main(void) -> int { &yolo<int>; // this line added yolo(&yolo<int>); } Also, without this addition, it compiles successfully if yolo()'s return type is given explicitly (as void).