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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [init/] [init-ref1.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// Submitted by Erik Rozendaal 
2
// Test case for GNATS bug 787.
3
// { dg-do run }
4
 
5
#include 
6
#include 
7
 
8
static int calls;
9
 
10
int &foo (int &arg)
11
{
12
  calls++;
13
  arg=0;
14
  return arg;
15
}
16
 
17
int &identity (int &x)
18
{
19
  return x;
20
}
21
 
22
int main()
23
{
24
  int a;
25
 
26
  calls = 0;
27
  int &b = ++foo (a);
28
  if (calls > 1)
29
    abort ();
30
  if (&a != &b)
31
    abort ();
32
  if (a != 1)
33
    abort ();
34
 
35
  calls = 0;
36
  int &c = ++identity (++foo (a));
37
  if (calls > 1)
38
    abort ();
39
  if (&a != &c)
40
    abort ();
41
  if (a != 2)
42
    abort ();
43
 
44
  exit (0);
45
}

powered by: WebSVN 2.1.0

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