From ff1aee6f236d2488ce7ff4f6e1f9eda4413121c2 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 26 Jan 2026 18:37:38 +0800 Subject: [PATCH] adds a test case --- tests/align/talign.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/align/talign.nim b/tests/align/talign.nim index 08373ee497..03ecd85115 100644 --- a/tests/align/talign.nim +++ b/tests/align/talign.nim @@ -1,5 +1,6 @@ discard """ ccodeCheck: "\\i @'NIM_ALIGN(128) NI mylocal1' .*" +matrix: "--mm:refc; --mm:orc" targets: "c cpp" output: "align ok" """ @@ -67,3 +68,22 @@ block: # bug #22419 f()() + +type Xxx = object + v {.align: 128.}: byte + +type Yyy = object + v: byte + v2: Xxx + +for i in 0..<3: + let x = new Yyy + # echo "addr v2.v:", cast[uint](addr x.v2.v) + doAssert cast[uint](addr x.v2.v) mod 128 == 0 + +let m = new Yyy +m.v2.v = 42 +doAssert m.v2.v == 42 +m.v = 7 +doAssert m.v == 7 +