The following testcase is miscompiled: #include <stdio.h> double foo() { return 1.0; } static struct S { S(); } s; static const double Y = foo()+2.0;
S::S() { printf("%f\n", Y); } int main() { printf("%f\n", Y); } Both printfs should print 3 based on Mark's insight in Comment #22 of bug 21089. -Chris -- Summary: C++ front-end doesn't correctly handle distinction between global initializers and ctors Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sabre at nondot dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24312