harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit d8c5440debe5b15d4c58b0864fb17b17c33bd986
parent a47c30aa492d3a58a6bb7635f89d98339012895f
Author: Sebastian <sebastian@sebsite.pw>
Date:   Sun,  5 Feb 2023 00:33:44 -0500

types: remove str -> *const char assignability rule

This was broken, and other suitable workarounds already exist (e.g.
constchar function in harec rt), so this isn't really worth it.

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Msrc/types.c | 3---
Mtests/05-implicit-casts.ha | 1-
2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/types.c b/src/types.c @@ -817,9 +817,6 @@ type_is_assignable(const struct type *to, const struct type *from) return to->pointer.flags & PTR_NULLABLE; } return true; - case STORAGE_STRING: - return to->pointer.referent->storage == STORAGE_CHAR - && to->pointer.referent->flags & TYPE_CONST; default: return false; } diff --git a/tests/05-implicit-casts.ha b/tests/05-implicit-casts.ha @@ -76,7 +76,6 @@ fn rules() void = { assert(compile("fn test() void = { let _u32: u32 = 42u64; };") as exited != EXIT_SUCCESS); // Pointer conversions - let cchr: *const char = "hello world"; let nptr: nullable *int = null; nptr = &i; let vptr: nullable *void = nptr;