Bug ID 158
Summary immutable vector incorrectly initialized from static constructor
Product GDC
Version 4.9.x
Hardware x86_64
OS Linux
Status NEW
Severity normal
Priority Normal
Component gdc
Assignee ibuclaw@gdcproject.org
Reporter vicencb@gmail.com

This code:

import std.stdio;
immutable int[] int_vector;
static this() { int_vector = [4]; }
void main() { writeln(int_vector); }

Compiled with gdc and executed:
gdc test.d && ./a.out

Prints:
[1]

Compiled with dmd and executed:
dmd test.d && ./gdc_bug

Prints:
[4]

Tested with branch gdc-4.9 commit e748df611430b497e6147309fbec4aad11e4ae26


You are receiving this mail because: