OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.dg/] [eh/] [scope1.C] - Diff between revs 301 and 384

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 384
// Test that we've scoped the destructor properly for variables declared
// Test that we've scoped the destructor properly for variables declared
// in a conditional.
// in a conditional.
// { dg-do run }
// { dg-do run }
extern "C" void abort ();
extern "C" void abort ();
class C
class C
{
{
  bool live;
  bool live;
 public:
 public:
  C();
  C();
  C(const C &);
  C(const C &);
  ~C ();
  ~C ();
  operator bool() const;
  operator bool() const;
};
};
void f1 ()
void f1 ()
{
{
  while (C br = C()) abort ();
  while (C br = C()) abort ();
}
}
void f2 ()
void f2 ()
{
{
  for (; C br = C(); ) abort ();
  for (; C br = C(); ) abort ();
}
}
void f3 ()
void f3 ()
{
{
  if (C br = C()) abort ();
  if (C br = C()) abort ();
}
}
void f4 ()
void f4 ()
{
{
  switch (C br = C())
  switch (C br = C())
    {
    {
    default:
    default:
      abort ();
      abort ();
    case false:
    case false:
      break;
      break;
    }
    }
}
}
int main()
int main()
{
{
  f1(); f2(); f3(); f4();
  f1(); f2(); f3(); f4();
  return 0;
  return 0;
}
}
C::C()
C::C()
{
{
  live = true;
  live = true;
}
}
C::C(const C &o)
C::C(const C &o)
{
{
  if (!o.live)
  if (!o.live)
    abort ();
    abort ();
  live = true;
  live = true;
}
}
C::~C()
C::~C()
{
{
  live = false;
  live = false;
}
}
C::operator bool() const
C::operator bool() const
{
{
  if (!live)
  if (!live)
    abort ();
    abort ();
  return false;
  return false;
}
}
 
 

powered by: WebSVN 2.1.0

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