I've asked a question here about whether taking the address of a function forces the compilation of said function specifically with regard to Substitution-Failure-Is-Not-An-Error. The most direct answer to this can be found here:
Informally, an object is odr-used if its address is taken, or a reference is bound to it, and a function is odr-used if a function call to it is made or its address is taken. If an object or a function is odr-used, its definition must exist somewhere in the program; a violation of that is a link-time error.
But all the compilers I've tested show this as perfectly doable:
void foo(int);
auto bar = &foo;
This isn't legal is it? But if not, why is it building?
bar
and you should get an error. Generally compilers will not go further than required by Standard and give you an error just because they can. They usually silently compile your code, and then break it in subtle ways after all tests are passed and it is time to ship. – Baird