OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.pt/] [inherit2.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
 
3
// Make sure we make the right unqualified class a friend
4
// See PR c++/4403
5
 
6
template  struct A
7
{
8
  struct AA;
9
  struct AC;
10
};
11
 
12
template  class B
13
  :public A
14
{
15
  friend struct B::AA;          // OK, this has an implicit typename
16
                                // as if it is 'friend struct typename B::AA'
17
                                // (I think there's a defect report
18
                                // about that)
19
  friend struct AC;     // this makes ::AC a friend *not* A::AC
20
 
21
  private: // only our friends can get out values
22
  static T valueA_AA;
23
  static T valueA_AC;
24
  static T value_AC;
25
};
26
template  T B::valueA_AA;
27
template  T B::valueA_AC;// { dg-error "" "" } private -
28
template  T B::value_AC;        // { dg-bogus "" "" }  -
29
 
30
// this one is a friend
31
template  struct A::AA
32
{
33
  int M ()
34
  {
35
    return B::valueA_AA;
36
  }
37
};
38
 
39
// this is not a friend
40
template  struct A::AC
41
{
42
  T M ()
43
  {
44
    return B::valueA_AC;        // { dg-error "" "" } within this context -
45
  }
46
};
47
 
48
// this is a friend
49
struct AC
50
{
51
  int M ()
52
  {
53
    return B::value_AC; // { dg-bogus "" "" }  -
54
  }
55
};
56
 
57
B b;
58
A::AA a_aa;
59
A::AC a_ac;
60
AC ac;
61
 
62
int main ()
63
{
64
  a_aa.M ();
65
  a_ac.M ();
66
  ac.M ();
67
}

powered by: WebSVN 2.1.0

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