The bug is present with both system `gcc 4.2.1 20070719' and `gcc 4.2.5 20080702 (prerelease)' built from ports. Also present on both i386 and amd64, althrough symptoms are different.
----- Code: struct struct1 { int int1; int int2; }; struct struct2 { struct2(const struct1 REF s) { S = s; } struct1 S; }; static const struct2 arr[] = { struct2( (struct1){1,2} ) }; int main() { return arr[0].S.int1 + arr[0].S.int2; } ----- Symptoms: $ g++ test.c -DREF='' /var/tmp//ccad9L64.o(.text+0x40): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `_0' /var/tmp//ccad9L64.o(.text+0x45): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `_0' collect2: ld returned 1 exit status $ g++ test.c -DREF='&' $ -O2 reverses this behavior: $ g++ -O2 test.c -DREF='&' /var/tmp//ccPsUIZY.o(.text+0x31): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `_0' /var/tmp//ccPsUIZY.o(.text+0x3b): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `_0' collect2: ld returned 1 exit status $ g++ -O2 test.c -DREF='' $ On amd64 error messages are different: $ g++ test.c -DREF='' /var/tmp//cclgnYrV.s: Assembler messages: /var/tmp//cclgnYrV.s:63: Error: junk `(%rip)' after expression $ g++ test.c -DREF='&' $ g++ -O2 test.c -DREF='' $ g++ -O2 test.c -DREF='&' /var/tmp//ccG5mp46.s: Assembler messages: /var/tmp//ccG5mp46.s:31: Error: junk `(%rip)' after expression /var/tmp//ccG5mp46.s:33: Error: junk `(%rip)' after expression $ -- Summary: static structures initialization, undefined reference to `_0' Product: gcc Version: 4.2.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amdmi3 at amdmi3 dot ru GCC build triplet: i386-portbld-freebsd7.0 GCC host triplet: i386-portbld-freebsd7.0 GCC target triplet: i386-portbld-freebsd7.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37770