repo.or.cz
/
Samba
/
gebeck_regimport.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
tdb: add overflow detection to tdb_expand_adjust()
[Samba/gebeck_regimport.git]
/
lib
/
ccan
/
container_of
/
test
/
compile_fail-bad-type.c
blob
b7a1459386b2d53c8f650388073f7e40f1934897
1
#include <ccan/container_of/container_of.h>
2
#include <stdlib.h>
3
4
struct
foo
{
5
int
a
;
6
char
b
;
7
};
8
9
int
main
(
int
argc
,
char
*
argv
[])
10
{
11
struct
foo foo
= { .
a
=
1
, .
b
=
2
};
12
int
*
intp
= &
foo
.
a
;
13
char
*
p
;
14
15
#ifdef FAIL
16
/* p is a char *, but this gives a struct foo * */
17
p
=
container_of
(
intp
,
struct
foo
,
a
);
18
#else
19
p
= (
char
*)
intp
;
20
#endif
21
return
p
==
NULL
;
22
}