On Monday, 16 April 2012 at 14:50:43 UTC, sclytrack wrote:
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 -unittestsrc/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 []) ?
Should do. It is a compiler bug. I've filed this issue in bugzilla: http://d.puremagic.com/issues/show_bug.cgi?id=7929 And posted a pull request to fix compiler code: https://github.com/D-Programming-Language/dmd/pull/884 Thanks. Kenji Hara
