mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Fix to zero length strings and better error when using assert with a non-constant error value.
This commit is contained in:
@@ -1252,8 +1252,7 @@ LLVMValueRef llvm_emit_string_const(GenContext *c, const char *str, const char *
|
||||
|
||||
LLVMValueRef llvm_emit_empty_string_const(GenContext *c)
|
||||
{
|
||||
LLVMValueRef data[2] = { LLVMConstNull(c->char_ptr_type), llvm_const_int(c, type_usz, 0) };
|
||||
return llvm_get_struct_named(c->chars_type, data, 2);
|
||||
return LLVMConstNull(c->chars_type);
|
||||
}
|
||||
|
||||
LLVMValueRef llvm_emit_zstring(GenContext *c, const char *str)
|
||||
|
||||
@@ -82,7 +82,7 @@ static inline bool sema_analyse_assert_stmt(SemaContext *context, Ast *statement
|
||||
if (message_expr)
|
||||
{
|
||||
if (!sema_analyse_expr(context, message_expr)) return false;
|
||||
if (!expr_is_const_string(message_expr)) RETURN_SEMA_ERROR(message_expr, "Expected a string as the error message.");
|
||||
if (!expr_is_const_string(message_expr)) RETURN_SEMA_ERROR(message_expr, "Expected a constant string as the error message.");
|
||||
FOREACH_BEGIN(Expr *e, statement->assert_stmt.args)
|
||||
if (!sema_analyse_expr(context, e)) return false;
|
||||
FOREACH_END();
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.539"
|
||||
#define COMPILER_VERSION "0.4.540"
|
||||
Reference in New Issue
Block a user