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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.dg/] [template/] [memfriend11.C] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
// { dg-do compile }
2
 
3
// Copyright (C) 2004 Free Software Foundation
4
// Contributed by Kriang Lerdsuwanakij 
5
 
6
// Nested class template of class template as friend
7
 
8
template struct A
9
{
10
  template  struct B
11
  {
12
    void f();
13
  };
14
};
15
 
16
class C {
17
  int i;
18
  template template  friend struct A::B;
19
};
20
 
21
template struct A
22
{
23
  template  struct B
24
  {
25
    void f();
26
  };
27
};
28
 
29
template<> struct A
30
{
31
  template  struct B
32
  {
33
    void f();
34
  };
35
};
36
 
37
template template  void A::B::f()
38
{
39
  C c;
40
  c.i = 0;
41
}
42
 
43
template template  void A::B::f()
44
{
45
  C c;
46
  c.i = 0;
47
}
48
 
49
template  void A::B::f()
50
{
51
  C c;
52
  c.i = 0;
53
}
54
 
55
template <> void A::B<'b'>::f()
56
{
57
  C c;
58
  c.i = 0;
59
}
60
 
61
int d2 = 0;
62
 
63
int main()
64
{
65
  A::B<0> b1;
66
  b1.f();
67
  A::B<&d2> b2;
68
  b2.f();
69
  A::B<'a'> b3;
70
  b3.f();
71
  A::B<'b'> b4;
72
  b4.f();
73
}

powered by: WebSVN 2.1.0

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