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
c++: Improve errors parsing a braced list [PR101232]
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
template
/
ptrmem30.C
blob
31e9b5d17f61f2976481c56ed7113d6525241969
1
// PR c++/70096
2
// { dg-do run }
3
4
int data_read;
5
6
struct Holder
7
{
8
void foo () { data_read = data; }
9
int data;
10
};
11
12
void
13
poison_stack ()
14
{
15
volatile char a[256];
16
__builtin_memset ((void *)a, 0xa, sizeof a);
17
}
18
19
template <typename F>
20
void test1 ()
21
{
22
Holder h;
23
h.data = 42;
24
F Holder::*fptr = &Holder::foo;
25
(h.*fptr)();
26
}
27
28
template <typename F>
29
void test2 ()
30
{
31
Holder h;
32
h.data = 42;
33
F Holder::*fptr1 = &Holder::foo;
34
F Holder::*fptr2 = fptr1;
35
(h.*fptr2)();
36
}
37
38
39
int main ()
40
{
41
poison_stack ();
42
test1<void()>();
43
poison_stack ();
44
test2<void()>();
45
}