mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We currently disallow these by deleting them in the `swift` namespace. This approach has several loopholes, all of which ultimately work because we happen to define specializations of `simplify_type` for `swift::Type`: * `llvm::isa/cast/dyn_cast`. The deleted partial specializations will not be selected because they are not defined in the `llvm` namespace. * The argument is a non-const `Type`. The deleted function templates will not be selected because they all accept a `const Type &`, and there is a better `Y &Val` partial specialization in LLVM. * Other casting function templates such as `isa_and_nonull` and `cast_if_present` are not deleted. Eliminate these loopholes by instead triggering a static assertion failure with a helpful message upon instantiation of `CastInfo` for `swift::Type`.