repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.pt
/
ptrmem2.C
blob
f14611c1af25c0ae55c6e73990963d037c5e95cc
1
// { dg-do run }
2
struct S;
3
4
template <S* (S::*p)()>
5
struct F {
6
S* f (S& s)
7
{
8
return (s.*p)();
9
}
10
};
11
12
template <int S::*p>
13
struct D {
14
void d (S& s)
15
{
16
(s.*p) = 3;
17
}
18
};
19
20
struct S {
21
S* g ();
22
int i;
23
F<&S::g> fg;
24
D<&S::i> di;
25
S* h(), k(F<&S::h>);
26
F<&S::g> fg2;
27
D<&S::i> di2;
28
};
29
30
S* S::g()
31
{
32
return this;
33
}
34
35
S* S::h()
36
{
37
return this;
38
}
39
40
int main()
41
{
42
S s;
43
s.i = 2;
44
s.di.d (s);
45
if (s.i != 3)
46
return 1;
47
if (s.fg2.f(s) != &s)
48
return 1;
49
}