mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Error when splat is used with raw varargs.
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.631"
|
||||
#define COMPILER_VERSION "0.4.632"
|
||||
8
test/test_suite/functions/splat_raw.c3
Normal file
8
test/test_suite/functions/splat_raw.c3
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
extern fn void foo(int x, ...);
|
||||
|
||||
fn void test(void*... y)
|
||||
{
|
||||
foo(1, ...y); // #error: raw varargs
|
||||
}
|
||||
Reference in New Issue
Block a user