Files
c3c/test/test_suite/errors/optional_sizeof.c3
Christoffer Lerno 25bccf4883 New faults and syntax (#2034)
- Remove `[?]` syntax.
- Change `int!` to `int?` syntax.
- New `fault` declarations.
- Enum associated values can reference the calling enum.
2025-03-10 00:11:35 +01:00

44 lines
518 B
Plaintext

fn int? abc()
{
return 1;
}
macro test()
{
return @catch(abc())?!!;
}
macro test2()
{
return @catch(abc())?;
}
fn void a()
{
String s = $typeof(test()).qnameof; // #error: This expression lacks
}
fn void b()
{
$sizeof(test()); // #error: This expression lacks
}
fn void c()
{
$sizeof(test2() ?? 1);
}
fn void? d()
{
$typeof(test2()!) g; // #error: This expression lacks a concrete type
}
macro e()
{
var g = test2()!; // #error: No type can be inferred from the optional result
}
fn void? h()
{
e();
}