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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/2039
2
// Test that a scoped reference to a member of an anonymous union member of
3
// a base class works properly.
4
 
5
// { dg-do run }
6
 
7
struct A
8
{
9
  long ia1;
10
  union
11
  {
12
    long ia2;
13
  };
14
};
15
 
16
struct B : public A
17
{
18
  void f1();
19
  void f2();
20
};
21
 
22
void B::f1()
23
{
24
  ia1 = 11;
25
  ia2 = 22;
26
}
27
 
28
void B::f2()
29
{
30
  ia1    = 33;
31
  A::ia2 = 44;   // <<< !!!????
32
}
33
 
34
int main()
35
{
36
  B x;
37
 
38
  x.f1();
39
  if (x.ia1 != 11 || x.ia2 != 22)
40
    return 1;
41
 
42
  x.f2();
43
  if (x.ia1 != 33 || x.ia2 != 44)
44
    return 1;
45
 
46
  return 0;
47
}

powered by: WebSVN 2.1.0

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