mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Cannot use void as a generic parameter #1546. Interfaces now support .ptr and .type directly without casting to any.
This commit is contained in:
29
test/test_suite/generic/generic_void.c3t
Normal file
29
test/test_suite/generic/generic_void.c3t
Normal file
@@ -0,0 +1,29 @@
|
||||
// #target: macos-x64
|
||||
module test(<Type>);
|
||||
|
||||
def Callback = fn Type();
|
||||
|
||||
module mymain;
|
||||
|
||||
import std::io;
|
||||
import test;
|
||||
|
||||
def VoidCb = test::Callback(<void>);
|
||||
|
||||
fn int main()
|
||||
{
|
||||
VoidCb a = null;
|
||||
void *b = a;
|
||||
return 0;
|
||||
}
|
||||
/* #expect: mymain.ll
|
||||
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%a = alloca ptr, align 8
|
||||
%b = alloca ptr, align 8
|
||||
store ptr null, ptr %a, align 8
|
||||
%0 = load ptr, ptr %a, align 8
|
||||
store ptr %0, ptr %b, align 8
|
||||
ret i32 0
|
||||
}
|
||||
Reference in New Issue
Block a user