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
Dead
[official-gcc.git]
/
gomp-20050608-branch
/
gcc
/
testsuite
/
g++.old-deja
/
g++.pt
/
local1.C
blob
d73a03001676121ee2842ea6c65a5057bf150410
1
// { dg-do run }
2
template <class STRUCT, class MEMBER> inline STRUCT *
3
setback(MEMBER *bp, MEMBER STRUCT::*offset)
4
{
5
if(!bp) return 0;
6
union { int i; MEMBER STRUCT::*of; } u;
7
u.of = offset;
8
return (STRUCT *) ((__SIZE_TYPE__) bp - u.i);
9
}
10
11
12
struct S
13
{
14
int i;
15
};
16
17
int main()
18
{
19
S s;
20
21
S* sp = setback (&s.i, &S::i);
22
}