mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
fix allocator::new_aligned #1898
This commit is contained in:
committed by
Christoffer Lerno
parent
7d0e143224
commit
d8ca0f69f6
25
test/unit/stdlib/core/mem_allocator.c3
Normal file
25
test/unit/stdlib/core/mem_allocator.c3
Normal file
@@ -0,0 +1,25 @@
|
||||
module std::core::allocator_test;
|
||||
|
||||
import std;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
}
|
||||
|
||||
struct Bar
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
List(<Foo>) foos;
|
||||
}
|
||||
|
||||
fn void test_new_aligned_compiles() @test
|
||||
{
|
||||
Bar* bar2 = allocator::new_aligned(allocator::heap(), Bar)!!;
|
||||
allocator::free_aligned(allocator::heap(), bar2);
|
||||
|
||||
Bar* bar = allocator::new_aligned(allocator::heap(), Bar, {.x = 1, .y = 2, .foos = {}})!!;
|
||||
allocator::free_aligned(allocator::heap(), bar);
|
||||
}
|
||||
Reference in New Issue
Block a user