mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Improve error message on const int*
This commit is contained in:
@@ -1832,6 +1832,12 @@ CHECK_ELLIPSIS:
|
|||||||
span = c->prev_span;
|
span = c->prev_span;
|
||||||
param_kind = VARDECL_PARAM;
|
param_kind = VARDECL_PARAM;
|
||||||
break;
|
break;
|
||||||
|
case TOKEN_CONST:
|
||||||
|
if (token_is_any_type(peek(c)))
|
||||||
|
{
|
||||||
|
RETURN_PRINT_ERROR_HERE("'const' is not allowed here, did you try to make a C style const parameter? In that case, consider using contracts with '@param [in]' for the parameter.");
|
||||||
|
}
|
||||||
|
FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
if (token_is_keyword(c->tok))
|
if (token_is_keyword(c->tok))
|
||||||
{
|
{
|
||||||
|
|||||||
3
test/test_suite/functions/const_param.c3
Normal file
3
test/test_suite/functions/const_param.c3
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import std;
|
||||||
|
fn int bar(const int* baz) // #error: 'const' is not allowed here, did you try to make a C style const parameter?
|
||||||
|
{}
|
||||||
Reference in New Issue
Block a user