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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [cond2.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// Positive testcase for decls in conditions.
3
 
4
extern "C" int printf(const char *, ...);
5
 
6
int up = 0;
7
int down = 0;
8
 
9
struct T
10
{
11
  int i;
12
  T(int j) { i = j; printf("UP\n"); up++; }
13
  T(const T& t) { i = t.i; printf("unwanted copy\n"); }
14
  ~T() { printf ("DOWN\n"); down++; }
15
  operator int () { return i; }
16
};
17
 
18
int main ()
19
{
20
  int t;
21
 
22
  if (T t = 1)
23
    ;
24
 
25
  printf ("\n");
26
 
27
  int j = 3;
28
  while (T t = j--)
29
    ;
30
 
31
  printf ("\n");
32
 
33
  j = 3;
34
  while (1)
35
    {
36
      T t = j--;
37
      if (t) continue;
38
      break;
39
    }
40
 
41
  printf ("\n");
42
 
43
  j = 3;
44
  for (;T t = j--;)
45
    ;
46
 
47
  printf ("\n");
48
 
49
  for (int k = 3; T t = k--;)
50
    ;
51
 
52
  printf ("\n");
53
 
54
  switch (T t = 34)
55
    {
56
    case 34:
57
      ;
58
    }
59
 
60
  printf ("\n");
61
 
62
  if (up == down && up == 18)
63
    return 0;
64
  else
65
    return 1;
66
}

powered by: WebSVN 2.1.0

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