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
strub: enable conditional support
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
torture
/
pr37716.C
blob
13b98d68a4044a83baaec40091d7f000c579299d
1
// PR tree-optimization/37716
2
// { dg-do compile }
3
4
struct A
5
{
6
struct B
7
{
8
int a, b, c, d;
9
void *e[1];
10
};
11
B *d;
12
inline void **f1 (int i) const
13
{
14
return d->e + d->c + i;
15
}
16
};
17
18
template <typename T>
19
struct C
20
{
21
struct D
22
{
23
void *v;
24
inline T & f3 ()
25
{
26
return *reinterpret_cast <T *> (this);
27
}
28
};
29
union
30
{
31
A p;
32
A::B *d;
33
};
34
T & operator[](int i)
35
{
36
if (d->a != 1)
37
f2 ();
38
return reinterpret_cast <D *> (p.f1 (i))->f3 ();
39
}
40
void f2 ();
41
void f3 (int i, const T & t);
42
};
43
44
class E
45
{
46
int e, f;
47
};
48
49
C <E> c;
50
51
void
52
foo (int x)
53
{
54
E e = c[x];
55
c.f3 (x, e);
56
}