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
tree-optimization/116610 - wrong SLP induction bias for mask peeling
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
template
/
ptrmem18.C
blob
c3124cd81bfc932b6899f8ab29025ca4cba16c14
1
// PR c++/33616
2
// { dg-do run }
3
// { dg-options "-O2" }
4
5
extern "C" void abort ();
6
7
struct S {
8
int c;
9
S () : c (0) {}
10
virtual void f1 () { c += 1; }
11
virtual void f2 () { c += 16; }
12
};
13
14
struct T {
15
S s;
16
};
17
18
typedef void (S::*Q) ();
19
20
template <Q P>
21
void test1 (T *t)
22
{
23
(t->s.*P)();
24
}
25
26
template <Q P>
27
void test2 (T *t)
28
{
29
S &s = t->s;
30
(s.*P)();
31
}
32
33
int
34
main ()
35
{
36
T t;
37
test1 <&S::f1> (&t);
38
if (t.s.c != 1)
39
abort ();
40
test1 <&S::f2> (&t);
41
if (t.s.c != 17)
42
abort ();
43
test2 <&S::f1> (&t);
44
if (t.s.c != 18)
45
abort ();
46
test2 <&S::f2> (&t);
47
if (t.s.c != 34)
48
abort ();
49
}