Add check to clang 6.0 compiler bug workaround
Extending on b68222e4e75d6cbe23c533f140733248df046c7e to ensure that it still
has the exact same behaviour as the previous code, as discussed with @hpvb.
(cherry picked from commit 03e11c13bfb1649fc9cf9a460249bce5e7f07462)