It is possible to employ compile-time type checks using the following syntax:
(expr : type)
The parentheses are mandatory. Unlike safe casts this construct has no run-time impact. It has two compile-time implications:
expr
with type type
.type
.This has the usual effect of both operations such as the given type being used as expected type when performing unqualified identifier resolution and the unification checking for abstract casts.