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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [template/] [memfriend7.C] - Blame information for rev 315

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-do compile }
2
 
3
// Copyright (C) 2003 Free Software Foundation
4
// Contributed by Kriang Lerdsuwanakij 
5
 
6
// Member function of class template as friend
7
// Erroneous case: mismatch during specialization
8
 
9
template  struct A {
10
  template  void f(U);
11
  void g();
12
  void h();
13
  void i(int);
14
  template  void j();
15
};
16
 
17
class C {
18
  int ii;                               // { dg-error "private" }
19
  template  template 
20
    friend void A::f(V);
21
  template  friend void A::g();
22
  template  friend void A::h();
23
  template  friend void A::i(int);
24
  template  template 
25
    friend void A::j();
26
};
27
 
28
template  struct A {
29
  void f(int);
30
  template  void g();
31
  int h();
32
  void i(char);
33
  template  void j();
34
};
35
 
36
template  void A::f(int)
37
{
38
  C c;
39
  c.ii = 0;                             // { dg-error "context" }
40
}
41
 
42
template  template  void A::g()
43
{
44
  C c;
45
  c.ii = 0;                             // { dg-error "context" }
46
}
47
 
48
template  int A::h()
49
{
50
  C c;
51
  c.ii = 0;                             // { dg-error "context" }
52
}
53
 
54
template  void A::i(char)
55
{
56
  C c;
57
  c.ii = 0;                             // { dg-error "context" }
58
}
59
 
60
template  template  void A::j()
61
{
62
  C c;
63
  c.ii = 0;                             // { dg-error "context" }
64
}
65
 
66
template <> struct A {
67
  void f(int);
68
  template  void g();
69
  int h();
70
  void i(char);
71
  template  void j();
72
};
73
 
74
void A::f(int)
75
{
76
  C c;
77
  c.ii = 0;                             // { dg-error "context" }
78
}
79
 
80
template  void A::g()
81
{
82
  C c;
83
  c.ii = 0;                             // { dg-error "context" }
84
}
85
 
86
template <> void A::g()
87
{
88
  C c;
89
  c.ii = 0;                             // { dg-error "context" }
90
}
91
 
92
int A::h()
93
{
94
  C c;
95
  c.ii = 0;                             // { dg-error "context" }
96
}
97
 
98
void A::i(char)
99
{
100
  C c;
101
  c.ii = 0;                             // { dg-error "context" }
102
}
103
 
104
template  void A::j()
105
{
106
  C c;
107
  c.ii = 0;                             // { dg-error "context" }
108
}
109
 
110
template <> void A::j<0>()
111
{
112
  C c;
113
  c.ii = 0;                             // { dg-error "context" }
114
}
115
 
116
int main()
117
{
118
  A a1;
119
  a1.f(0);                              // { dg-message "instantiated" }
120
  a1.g();                               // { dg-message "instantiated" }
121
  a1.g();                               // { dg-message "instantiated" }
122
  a1.h();                               // { dg-message "instantiated" }
123
  a1.i('a');                            // { dg-message "instantiated" }
124
  a1.j<1>();                               // { dg-message "instantiated" }
125
  A a2;
126
  a2.f(0);
127
  a2.g();                               // { dg-message "instantiated" }
128
  a2.g();
129
  a2.h();
130
  a2.i('a');
131
  a2.j<1>();                               // { dg-message "instantiated" }
132
  a2.j<0>();
133
}

powered by: WebSVN 2.1.0

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