I see at least two ways that unused functions can affect behavior:
They can instantiate templates:
- ...that can have static variables with constructors with side effects.
- ...that can perform stateful metaprogramming to affect other code (instantiated class defines a
friend
function, then other template checks for its existence).
Certain kinds of UB can cause unused functions can get called in practice.