mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Assert when encountering a test function with raw vaarg parameters.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
- Parse error in `$defined` was not handled correctly, leading to an assertion.
|
||||
- Assert when struct size would exceed 4 GB.
|
||||
- Assert when encountering a malformed module alias.
|
||||
- Assert when encountering a test function with raw vaarg parameters.
|
||||
|
||||
### Stdlib changes
|
||||
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.
|
||||
|
||||
@@ -4269,7 +4269,8 @@ static inline bool sema_analyse_func(SemaContext *context, Decl *decl, bool *era
|
||||
unsigned params = vec_size(sig->params);
|
||||
if (params)
|
||||
{
|
||||
RETURN_SEMA_ERROR(sig->params[0], "%s functions may not take any parameters.",
|
||||
SourceSpan span = sig->params[0] ? sig->params[0]->span : decl->span;
|
||||
RETURN_SEMA_ERROR_AT(span, "%s functions may not take any parameters.",
|
||||
is_init_finalizer ? "'@init' and '@finalizer'" : "'@test' and '@benchmark'");
|
||||
}
|
||||
TypeInfo *rtype_info = type_infoptr(sig->rtype);
|
||||
|
||||
@@ -299,7 +299,7 @@ fn bool parse_result(DString out, RunSettings settings, List{String}* cmdline, O
|
||||
|
||||
if (!find_and_mark_error(&settings, ...parts[:5]))
|
||||
{
|
||||
unexpected_errors.push(string::tformat(" - %s at %s:%s: \"%s\"", parts[0], parts[1].file_tbasename()!!, parts[2], parts[4]));
|
||||
unexpected_errors.push(string::tformat(" - %s at %s:%s: %s", parts[0], parts[1].file_tbasename()!!, parts[2], parts[4]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
test/test_suite/functions/invalid_test_vaarg.c3
Normal file
1
test/test_suite/functions/invalid_test_vaarg.c3
Normal file
@@ -0,0 +1 @@
|
||||
fn void asdf(...) @test; // #error: '@test' and '@benchmark' functions may not take any parameters.
|
||||
Reference in New Issue
Block a user