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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [aggr2.C] - Rev 693

Compare with Previous | Blame | View Log

// PR c++/15172
// { dg-do run }

extern "C" int printf (const char *, ...);
extern "C" void abort ();

struct A {
  static A* p;

  A() { p = this; }
  A(const A&);
  ~A() { if (this != p) abort (); }
  void print () { }
};

A* A::p;

struct B {
  A a;
};

B b = { A () };

struct A2 {
  static A2* p;

  A2() { p = this; }
  A2(const A2&);
  ~A2() { if (this != p) abort (); }
  void print () { }
};

A2* A2::p;

struct B2 {
  A2 a2;
};

int main () {
  b.a.print ();
  {
    B2 b2 = { A2() };
    b2.a2.print ();
  }
} 
    

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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