In the derivation, we write:
$$ \begin{align} G &= H - TS &\quad&\to&\quad \mathrm dG &= \mathrm dH - T\,\mathrm dS - S\,\mathrm dT \\ H &= U + pV &\quad&\to&\quad \mathrm dH &= \mathrm dU + p\,\mathrm dV + V\,\mathrm dp \\ U &= Q + W &\quad&\to&\quad \mathrm dU &= \mathrm dQ - p\,\mathrm dV \\ & & & & &= T\,\mathrm dS - p\,\mathrm dV \end{align} $$
So solving these gives
$$\mathrm dG = V\,\mathrm dp - S\,\mathrm dT$$
But what we actually write is
$$\mathrm dH = \mathrm dU + p_\mathrm{int}\,\mathrm dV + V\,\mathrm dp$$
And in
$$\mathrm dU = \mathrm dQ - p\,\mathrm dV = T\,\mathrm dS - p_\mathrm{ext}\,\mathrm dV$$
so on solving, it should be
$$\mathrm dH = T\,\mathrm dS - (p_\mathrm{ext} - p_\mathrm{int})\mathrm dV + V\,\mathrm dp$$
And only in reversible process, should it be valid to write
$$p_\mathrm{ext} - p_\mathrm{int} = 0$$
But my teacher argued that because this is a state function, it should be valid for all types of processes. I'm a bit confused about how his claim is valid. Can someone please explain what he means or even if he is correct or not?