According to the standard The Boolean_expression e ~ f has value true if and only if the values of e and f are both attached and such that e.is_equal (f) holds. It does not say anything about type conformance. I guess the standard needs to be updated, but would like to keep this bug report until this is fixed.