Support newer GCC versions

Also, fix a very stupid bug which I hope nobody ever sees, else they
may realise what an absolutely terrible C++ coder I am.