const AB c = {a,20, numbers};

sclytrack sclytrack at hotmail.com
Mon Apr 16 07:50:42 PDT 2012


struct AB
{
	int a;
	int b;
	int [] numbers;
}

int main()
{
	int a = 300;
	const int [] numbers = new int[2];
	const AB c = {a,20, numbers};		// line 66
     writeln(c);
	return 0;
}

----------------------------
-debug
-unittest

src/main.d(66): Error: cannot implicitly convert expression (numbers) of 
type const(int[]) to int[]

---------------------------


const AB c;

	typeof(c.a)	is  const(int);
	typeof(c.numbers) is const(int []);


Shouldn't the code above accept the const(int [])   ?



More information about the Digitalmars-d-learn mailing list