Handle const-folding with different pointer casts