mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Bitstruct value cannot be used to index a const array in compile time. #2512
This commit is contained in:
25
test/test_suite/bitstruct/bitstruct_to_index.c3t
Normal file
25
test/test_suite/bitstruct/bitstruct_to_index.c3t
Normal file
@@ -0,0 +1,25 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
import std;
|
||||
|
||||
bitstruct Some : char
|
||||
{
|
||||
char v : 0 .. 4;
|
||||
}
|
||||
|
||||
const int[8] SOME_MAP = some_macro();
|
||||
|
||||
macro some_macro()
|
||||
{
|
||||
Some $s = { 8 };
|
||||
int[8] $map;
|
||||
$for var $i = 0; $i < 4; $i++:
|
||||
$s = { .v = $s.v >> 1 };
|
||||
$map[$s.v] = 1;
|
||||
$endfor;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
@test.SOME_MAP = local_unnamed_addr constant { i32, i32, i32, i32, i32, [3 x i32] } { i32 1, i32 1, i32 1, i32 0, i32 1, [3 x i32] zeroinitializer }, align 16
|
||||
Reference in New Issue
Block a user