I think this runs into ยง7.1.6.4 [dcl.spec.auto]/p11:
If the type of an entity with an undeduced placeholder type is needed
to determine the type of an expression, the program is ill-formed.
You need the type of terminal
to determine the type of the id-expression terminal
in return terminal(func(term));
(edited, hat tip @Richard Smith), but at the point of that expression you can’t deduce the type of terminal
yet.