https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83634
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The reason we end up with CONVERT_EXPR from error_mark_node to void is that cp_fold ignores casts to void: case CONVERT_EXPR: case NOP_EXPR: case NON_LVALUE_EXPR: if (VOID_TYPE_P (TREE_TYPE (x))) return x; and thus the operand is handled only by cp_fold_r and doesn't have the possibility to turn the whole CONVERT_EXPR into error_mark_node. So, either we should get rid of this (and for VOID_TYPE_P perhaps just cp_fold_rvalue and build the conversion if the folding returned something different (and special case if it returned error_mark_node), or we need the gimplifier to handle this. The reason why it doesn't handle it is that while STRIP_NOPS or STRIP_SIGN_NOPS have checks for error_mark_node, STRIP_USELESS_TYPE_CONVERSION doesn't. So, either we do add the == error_mark_node comparison in there, or use a copy of that in the gimplifier which will do the error_mark_node checks.