mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Check pointer/slice/etc on [out] and & params. #2156.
This commit is contained in:
12
test/test_suite/contracts/inout_macro.c3
Normal file
12
test/test_suite/contracts/inout_macro.c3
Normal file
@@ -0,0 +1,12 @@
|
||||
import std;
|
||||
<*
|
||||
@param [&out] x
|
||||
@require $defined(*x) : "x must be a pointer"
|
||||
*>
|
||||
macro foo(x) => *x = 1;
|
||||
|
||||
fn int main()
|
||||
{
|
||||
foo(0); // #error: Expected a pointer
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user