@@ -3795,14 +3795,24 @@ $(H3 $(LNAME2 safe-functions, Safe Functions))
3795
3795
$(UL
3796
3796
$(LI No casting from a pointer type `T` to any type `U` with pointers, except when:)
3797
3797
* `T` implicitly converts to `U`
3798
- * `U` implements class or interface `T`
3798
+ * `U` $(DDSUBLINK spec/expression, cast_class, implements) class or interface
3799
+ `T`, and both types are `extern(D)`
3799
3800
* `T.opCast!U` is `@safe`
3800
- * Both types $(DDSUBLINK spec/expression, cast_array, are dynamic arrays) and:
3801
- * Casting a source element to a target element type is `@safe`
3801
+ * Both types $(DDSUBLINK spec/expression, cast_array, are dynamic arrays), or
3802
+ both types $(DDSUBLINK spec/expression, cast_pointers, are raw pointers), and:
3803
+ * The target element type is not a pointer type
3804
+ * The target element type is not mutable when the source element type is a pointer type
3805
+ * Either the target element type is a dynamic array, or the target element
3806
+ type is no larger than the source element type
3807
+ * Any source element type modifiers implicitly convert to the target element type modifiers
3808
+ * Neither element type is a function type
3802
3809
* The target element type is not mutable when the source type is `void[]`
3803
- * The target type is not `bool[]` unless the operand is a literal
3810
+ * The target element type is not $(DDSUBLINK spec/type, bool, `bool`)
3811
+ * The source element type is not `bool` when the target element type is mutable
3812
+ * Neither element type is $(DDSUBLINK spec/struct, opaque_struct_unions, opaque).
3804
3813
$(LI No casting from any non-pointer type to a pointer type.)
3805
- $(LI No pointer arithmetic (including pointer indexing & slicing).)
3814
+ $(LI No $(DDSUBLINK spec/expression, pointer_arithmetic, pointer arithmetic)
3815
+ (including pointer indexing & slicing).)
3806
3816
$(LI Cannot access union fields that:)
3807
3817
* Have pointers or references overlapping with other types
3808
3818
* Have invariants overlapping with other types
0 commit comments