mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
28 lines
326 B
C
28 lines
326 B
C
module test;
|
|
|
|
import std::io;
|
|
|
|
macro @foo(int* &hello)
|
|
{
|
|
hello = hello; // #error: You cannot assign to a ref
|
|
}
|
|
|
|
macro @bar(Foo* &f)
|
|
{
|
|
f.a = 1;
|
|
int* x = &f.a;
|
|
Foo **ff = &f; // #error: You may not take the address
|
|
}
|
|
|
|
struct Foo
|
|
{
|
|
int a;
|
|
}
|
|
|
|
fn void main()
|
|
{
|
|
int a;
|
|
@foo(a);
|
|
Foo x;
|
|
@bar(x);
|
|
} |