aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-12-14 21:58:12 +0000
committergingerBill <bill@gingerbill.org>2018-12-14 21:58:12 +0000
commit9d6666f333cd427a720c639ee0b9b513d79fe8a0 (patch)
tree6516a49a891bc1983703703aaf485d549ec0c668 /src/check_expr.cpp
parentd29335ececec993c8df336b6482a6b213bc13361 (diff)
Disallow casting between `cstring` and `[]u8`
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 37a54854c..1e487fb00 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -1926,11 +1926,11 @@ bool check_is_castable_to(CheckerContext *c, Operand *operand, Type *y) {
return true;
}
- // []byte/[]u8 <-> string
- if (is_type_u8_slice(src) && is_type_string(dst)) {
+ // []byte/[]u8 <-> string (not cstring)
+ if (is_type_u8_slice(src) && (is_type_string(dst) && !is_type_cstring(dst))) {
return true;
}
- if (is_type_string(src) && is_type_u8_slice(dst)) {
+ if ((is_type_string(src) && !is_type_cstring(src)) && is_type_u8_slice(dst)) {
// if (is_type_typed(src)) {
return true;
// }