aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorJimmi Holst Christensen <jhc@dismail.de>2019-04-24 18:42:55 +0200
committerGitHub <noreply@github.com>2019-04-24 18:42:55 +0200
commite4a86d4653c5854437371e2b63006bd4a1b4c83d (patch)
tree66fcb47280ed14f33e86deb805be79f9497bc537 /src/ir.cpp
parente553ade090582d7f863e2f02e6e0c803d4b9408b (diff)
parent1a2e02e267216bb35937d25598c773255d830b25 (diff)
downloadzig-e4a86d4653c5854437371e2b63006bd4a1b4c83d.tar.gz
zig-e4a86d4653c5854437371e2b63006bd4a1b4c83d.zip
Merge pull request #2351 from ziglang/fixed-2346
fixes #2346
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index a3d08b5327..e5192cf347 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -188,6 +188,19 @@ static ConstExprValue *const_ptr_pointee_unchecked(CodeGen *g, ConstExprValue *c
assert(get_src_ptr_type(const_val->type) != nullptr);
assert(const_val->special == ConstValSpecialStatic);
ConstExprValue *result;
+
+ switch (type_has_one_possible_value(g, const_val->type->data.pointer.child_type)) {
+ case OnePossibleValueInvalid:
+ zig_unreachable();
+ case OnePossibleValueYes:
+ result = create_const_vals(1);
+ result->type = const_val->type->data.pointer.child_type;
+ result->special = ConstValSpecialStatic;
+ return result;
+ case OnePossibleValueNo:
+ break;
+ }
+
switch (const_val->data.x_ptr.special) {
case ConstPtrSpecialInvalid:
zig_unreachable();