Frederick Gotham <
cauldwel...@gmail.com> wrote:
> It seems that an automated optimiser realises that "Func" will never be called and so it doesn't require its definition.
I doubt that the standard guarantees linker errors for code that might
or might not be optimized away by the linker.
Btw, this is one of the reasons why one should *always* test compiling
one's projects *with* and *without* optimizations. It has bitten me
in the behind more than once that I have the habit of always
compiling with optimizations and never trying what happens if I leave
optimizations out. More than once when compiling without optimizations
I have got linker errors because I didn't realize that something
was not defined properly but the compiler was hiding the error with
optimizations.
(Of course even then you can really rely on finding this out by
simply leaving optimizations options out, as there's no guarantee that
the compiler will not keep optimizing some things out.)