fix allocator::new_aligned #1898

This commit is contained in:
Rene Hangstrup Møller
2025-01-27 20:24:35 +01:00
committed by Christoffer Lerno
parent 7d0e143224
commit d8ca0f69f6
2 changed files with 27 additions and 2 deletions

View 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);
}