mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
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:
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fn void test()
|
||||
{
|
||||
int[*] a = {}; // #error: Zero length
|
||||
int[?] a = {}; // #error: Zero length
|
||||
}
|
||||
Reference in New Issue
Block a user