d: Delay removing DECL_EXTERNAL from thunks until funcion has finished
Second part to fixing PR109108, don't blindly generate the associated
function definition of all referenced thunks in the compilation. Just
delay finishing a thunk until the function gets codegen itself. If the
function never gets a definition, then the thunk is left as "extern".
gcc/d/ChangeLog:
* decl.cc (finish_thunk): Unset DECL_EXTERNAL on thunk.
(make_thunk): Set DECL_EXTERNAL on thunk, don't call build_decl_tree.
(finish_function): Call finish_thunk on forward referenced thunks.