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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [tc1/] [dr193.C] - Rev 826

Compare with Previous | Blame | View Log

// { dg-do run }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR193: Order of destruction of local automatics of destructor 

extern "C" void abort(void);

namespace N1 {
  bool a_done = false;
  struct A
  { 
    ~A()
    {
      a_done = true;
    }
  };

  struct B
  { 
    ~B()
    {
      if (!a_done)
        abort();
    }
  };

  struct C {
    B x;
    ~C() {
      A y;
    }
  };
}


namespace N2 {
  bool a_done = false;

  template <class>
  struct A
  { 
    ~A()
    {
      a_done = true;
    }
  };

  template <class>
  struct B
  { 
    ~B()
    {
      if (!a_done)
        abort();
    }
  };

  template <class T>
  struct C {
    B<T> x;
    ~C() {
      A<T> y;
    }
  };
}


int main(void)
{
  N1::C c1;
  N2::C<void> c2;
  return 0;
}

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.