mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
49 lines
911 B
Plaintext
49 lines
911 B
Plaintext
// #target: macos-x64
|
|
module test;
|
|
import std;
|
|
|
|
// issue 1966
|
|
|
|
struct MsgHeader @packed
|
|
{
|
|
ulong enqueued_by_router_us;
|
|
}
|
|
|
|
enum ClientState
|
|
{
|
|
NOT_INITIALIZED,
|
|
WAITING_FOR_LOGIN,
|
|
READY,
|
|
WAITING_FOR_CLOSE,
|
|
}
|
|
|
|
struct Client
|
|
{
|
|
ClientState state;
|
|
MsgHeader header;
|
|
ushort service_id;
|
|
ElasticArray{ulong, 1} subscribers;
|
|
}
|
|
|
|
Client[10] clients;
|
|
|
|
fn void main()
|
|
{
|
|
void* a = ((void*)(&clients[0])) + Client.sizeof;
|
|
void* b = &clients[1];
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
%Client = type <{ i32, %MsgHeader, i16, [2 x i8], %"ElasticArray{ulong, 1}" }>
|
|
%MsgHeader = type { i64 }
|
|
%"ElasticArray{ulong, 1}" = type { i64, [1 x i64] }
|
|
|
|
define void @test.main() #0 {
|
|
entry:
|
|
%a = alloca ptr, align 8
|
|
%b = alloca ptr, align 8
|
|
store ptr getelementptr (i8, ptr @test.clients, i64 32), ptr %a, align 8
|
|
store ptr getelementptr inbounds (i8, ptr @test.clients, i64 32), ptr %b, align 8
|
|
ret void
|
|
} |