OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [init/] [for1.C] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
// PR c++/13865
// PR c++/13865
// Bug: We were destroying 'a' before executing the loop.
// Bug: We were destroying 'a' before executing the loop.
#include 
#include 
int i;
int i;
int r;
int r;
class A
class A
{
{
public:
public:
  A() { printf("A ctor\n"); }
  A() { printf("A ctor\n"); }
  ~A()
  ~A()
  {
  {
    printf("A dtor\n");
    printf("A dtor\n");
    if (i != 1)
    if (i != 1)
      r = 1;
      r = 1;
  }
  }
};
};
int main(int argc, char **argv)
int main(int argc, char **argv)
{
{
  for (A a; i < 2; ++i) {
  for (A a; i < 2; ++i) {
    printf("iteration %d\n", i);
    printf("iteration %d\n", i);
  }
  }
  return r;
  return r;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.