This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/24312] New: C++ front-end doesn't correctly handle distinction between global initializers and ctors


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]