aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-02-07 00:23:05 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-02-07 00:23:05 -0700
commit4174134108fdef462c2483f4ca5aa40dd6398d55 (patch)
tree5629fa9864ba6a265783c651343996b540266c66 /src/analyze.cpp
parentfc310965197511ade998b5e6439c92a40af244d1 (diff)
downloadzig-4174134108fdef462c2483f4ca5aa40dd6398d55.tar.gz
zig-4174134108fdef462c2483f4ca5aa40dd6398d55.zip
unreachable return type can cast to any other return type
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 4f980df9d5..bd31abd6a7 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -1655,8 +1655,10 @@ static bool types_match_const_cast_only(TypeTableEntry *expected_type, TypeTable
if (expected_type->data.fn.fn_type_id.is_cold != actual_type->data.fn.fn_type_id.is_cold) {
return false;
}
- if (!types_match_const_cast_only(expected_type->data.fn.fn_type_id.return_type,
- actual_type->data.fn.fn_type_id.return_type))
+ if (actual_type->data.fn.fn_type_id.return_type->id != TypeTableEntryIdUnreachable &&
+ !types_match_const_cast_only(
+ expected_type->data.fn.fn_type_id.return_type,
+ actual_type->data.fn.fn_type_id.return_type))
{
return false;
}