Error when splat is used with raw varargs.

This commit is contained in:
Christoffer Lerno
2023-09-04 22:24:46 +02:00
parent d1bb9c55ee
commit fe0ae4a9aa
3 changed files with 13 additions and 1 deletions

View File

@@ -1512,6 +1512,10 @@ static inline bool sema_call_analyse_invocation(SemaContext *context, Expr *call
if (!sema_analyse_expr(context, vararg_splat)) return false;
// 11d. If it is allowed.
if (!variadic_type)
{
RETURN_SEMA_ERROR(vararg_splat, "Splat may not be used with raw varargs.");
}
if (!expr_may_splat_as_vararg(vararg_splat, variadic_type))
{
SEMA_ERROR(vararg_splat, "It's not possible to splat %s as vararg of type %s",

View File

@@ -1 +1 @@
#define COMPILER_VERSION "0.4.631"
#define COMPILER_VERSION "0.4.632"

View File

@@ -0,0 +1,8 @@
extern fn void foo(int x, ...);
fn void test(void*... y)
{
foo(1, ...y); // #error: raw varargs
}