From 337aa911a9027602d47cd56ddbfcde0230a48943 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 2 Sep 2024 19:53:09 -0400 Subject: Auto promote to C String from Text --- types.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'types.c') diff --git a/types.c b/types.c index 16a77528..60168a86 100644 --- a/types.c +++ b/types.c @@ -289,6 +289,10 @@ bool can_promote(type_t *actual, type_t *needed) return cmp == NUM_PRECISION_EQUAL || cmp == NUM_PRECISION_LESS; } + // Text to C String + if (actual->tag == TextType && !Match(actual, TextType)->lang && needed->tag == CStringType) + return true; + // Automatic dereferencing: if (actual->tag == PointerType && !Match(actual, PointerType)->is_optional && can_promote(Match(actual, PointerType)->pointed, needed)) -- cgit v1.2.3