mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
55 lines
842 B
C
55 lines
842 B
C
|
|
macro int abc(int x) { return 1; }
|
|
macro int! def2(int y) @maydiscard { return 1; }
|
|
macro int! def3(int z) { return 1; }
|
|
|
|
fn void test1()
|
|
{
|
|
int! x;
|
|
abc(x); // #error: The result of this call is optional due to its argumen
|
|
}
|
|
|
|
fn void test2()
|
|
{
|
|
int! x;
|
|
int y;
|
|
abc(y);
|
|
abc(x) + 4; // #error: An optional value may not be discarded
|
|
}
|
|
|
|
fn void test3()
|
|
{
|
|
int! x;
|
|
int y;
|
|
def2(1);
|
|
def2(x); // #error: The result of this call is optional due to its argumen
|
|
}
|
|
|
|
fn void test4()
|
|
{
|
|
int! x;
|
|
int y;
|
|
def2(1);
|
|
def2(x) + 4; // #error: An optional value may not be discarded
|
|
}
|
|
|
|
fn void test5()
|
|
{
|
|
int! x;
|
|
int y;
|
|
def3(y); // #error: The result of the macro must
|
|
}
|
|
|
|
fn void test6()
|
|
{
|
|
int! x;
|
|
int y;
|
|
def3(x); // #error: The result of the macro must
|
|
}
|
|
|
|
fn void test7()
|
|
{
|
|
int y;
|
|
def3(y) + 4; // #error: An optional value may not be discarded
|
|
}
|