aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-02-07 01:25:04 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-02-07 01:25:04 -0700
commit7f6b0ba6eafd566a5a9243286ba59fc0e4587d30 (patch)
treeae46e6a16e53adae3831978cf7f72c4629c42a19 /src/analyze.cpp
parent4174134108fdef462c2483f4ca5aa40dd6398d55 (diff)
downloadzig-7f6b0ba6eafd566a5a9243286ba59fc0e4587d30.tar.gz
zig-7f6b0ba6eafd566a5a9243286ba59fc0e4587d30.zip
ability to explicitly cast maybe pointers to each other
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index bd31abd6a7..e37885f353 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -3702,6 +3702,15 @@ static TypeTableEntry *analyze_cast_expr(CodeGen *g, ImportTableEntry *import, B
return resolve_cast(g, context, node, expr_node, wanted_type, CastOpPointerReinterpret, false);
}
+ // explicit cast from maybe pointer to another maybe pointer
+ if (actual_type->id == TypeTableEntryIdMaybe &&
+ actual_type->data.maybe.child_type->id == TypeTableEntryIdPointer &&
+ wanted_type->id == TypeTableEntryIdMaybe &&
+ wanted_type->data.maybe.child_type->id == TypeTableEntryIdPointer)
+ {
+ return resolve_cast(g, context, node, expr_node, wanted_type, CastOpPointerReinterpret, false);
+ }
+
// explicit cast from child type of maybe type to maybe type
if (wanted_type->id == TypeTableEntryIdMaybe) {
if (types_match_const_cast_only(wanted_type->data.maybe.child_type, actual_type)) {