Allow (int[*]) { 1, 2 } cast style initialization. Experimental change from [*] to [?]. Fix issue where compile time declarations in expression list would not be handled properly.

This commit is contained in:
Christoffer Lerno
2025-01-25 22:10:12 +01:00
parent ca91ad4097
commit e40bab2d30
93 changed files with 529 additions and 466 deletions

View File

@@ -2,7 +2,7 @@ fn void test()
{
char* hello = "123";
String a = { '1', '2', '3' };
char[*] b = { '1', '2', '3' };
char[?] b = { '1', '2', '3' };
char[3] c = { '1', '2', '3' };
char* d = { '1', '2', '3' }; // #error: Pointers cannot be initialized using an initializer list, instead you need to take the address of an array
}

View File

@@ -1,11 +1,11 @@
// #target: windows-x64
module test;
const int[*] X = int[*] { 1, 2, 3 };
int[*] y = int[*] { 1, 2, 3 };
const int[?] X = int[?] { 1, 2, 3 };
int[?] y = int[?] { 1, 2, 3 };
fn void main()
{
int x = $typeof(int[*] { 1, 2, 3}).len;
int x = $typeof(int[?] { 1, 2, 3}).len;
int z = X.len;
int w = y.len;
}

View File

@@ -1,4 +1,4 @@
fn void test()
{
int[*] a = {}; // #error: Zero length
int[?] a = {}; // #error: Zero length
}