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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [cond2.C] - Diff between revs 305 and 338

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

Rev 305 Rev 338
// { dg-do run  }
// { dg-do run  }
// Positive testcase for decls in conditions.
// Positive testcase for decls in conditions.
extern "C" int printf(const char *, ...);
extern "C" int printf(const char *, ...);
int up = 0;
int up = 0;
int down = 0;
int down = 0;
struct T
struct T
{
{
  int i;
  int i;
  T(int j) { i = j; printf("UP\n"); up++; }
  T(int j) { i = j; printf("UP\n"); up++; }
  T(const T& t) { i = t.i; printf("unwanted copy\n"); }
  T(const T& t) { i = t.i; printf("unwanted copy\n"); }
  ~T() { printf ("DOWN\n"); down++; }
  ~T() { printf ("DOWN\n"); down++; }
  operator int () { return i; }
  operator int () { return i; }
};
};
int main ()
int main ()
{
{
  int t;
  int t;
  if (T t = 1)
  if (T t = 1)
    ;
    ;
  printf ("\n");
  printf ("\n");
  int j = 3;
  int j = 3;
  while (T t = j--)
  while (T t = j--)
    ;
    ;
  printf ("\n");
  printf ("\n");
  j = 3;
  j = 3;
  while (1)
  while (1)
    {
    {
      T t = j--;
      T t = j--;
      if (t) continue;
      if (t) continue;
      break;
      break;
    }
    }
  printf ("\n");
  printf ("\n");
  j = 3;
  j = 3;
  for (;T t = j--;)
  for (;T t = j--;)
    ;
    ;
  printf ("\n");
  printf ("\n");
  for (int k = 3; T t = k--;)
  for (int k = 3; T t = k--;)
    ;
    ;
  printf ("\n");
  printf ("\n");
  switch (T t = 34)
  switch (T t = 34)
    {
    {
    case 34:
    case 34:
      ;
      ;
    }
    }
  printf ("\n");
  printf ("\n");
  if (up == down && up == 18)
  if (up == down && up == 18)
    return 0;
    return 0;
  else
  else
    return 1;
    return 1;
}
}
 
 

powered by: WebSVN 2.1.0

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