mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Splatting optional compile-time macro parameter from inside lambda expression does not work #2532.
This commit is contained in:
31
test/test_suite/lambda/lambda_splat_macro.c3t
Normal file
31
test/test_suite/lambda/lambda_splat_macro.c3t
Normal file
@@ -0,0 +1,31 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
import std;
|
||||
fn int main()
|
||||
{
|
||||
bool x = test1a(true)();
|
||||
return 0;
|
||||
}
|
||||
|
||||
macro test1a(bool $a = ...) => fn bool()
|
||||
{
|
||||
return test1b(...$a);
|
||||
};
|
||||
macro test1b(bool $a = ...) => $defined($a) ??? $a : false;
|
||||
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%x = alloca i8, align 1
|
||||
%0 = call i8 @"test.test1a$lambda1"()
|
||||
store i8 %0, ptr %x, align 1
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
define internal zeroext i8 @"test.test1a$lambda1"() #0 {
|
||||
entry:
|
||||
ret i8 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user