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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [other/] [ptrmem1.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
// Copyright (C) 2001 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 31 Dec 2001 
5
 
6
// PR 4379. We created pointers to member references and pointers to
7
// member fields when we shouldn't have.
8
 
9
int gs;
10
int gm;
11
 
12
struct D {
13
  D () :m (gm) {}
14
 
15
  int &m;
16
  static int &s;
17
 
18
  int Foo ();
19
};
20
 
21
int &D::s = gs;
22
 
23
template int f1(T x)
24
{
25
  return x != &gm;
26
}
27
template int f2(T x)
28
{
29
  return x != &gs;
30
}
31
 
32
int D::Foo ()
33
{
34
  int r;
35
 
36
  if (f1( &(D::m)))
37
    return 3;
38
 
39
  if (f2( &D::s))
40
    return 1;
41
  if (f2( &(D::s)))
42
    return 2;
43
  return 0;
44
}
45
 
46
int Foo ()
47
{
48
  if (f2( &D::s))
49
    return 4;
50
  if (f2( &(D::s)))
51
    return 5;
52
  return 0;
53
}
54
 
55
int main ()
56
{
57
  D d;
58
  int r = d.Foo ();
59
  if (r)
60
    return r;
61
  r = Foo ();
62
  if (r)
63
    return r;
64
  return 0;
65
 
66
}

powered by: WebSVN 2.1.0

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