1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-02 19:42:23 +00:00
cc65/test/val/void-size1.c
Greg King 750a527100 Made C's sizeof operator work with initialized void variables.
Added regression tests that check cc65's handling of void variables.
2017-03-12 14:41:32 -04:00

57 lines
797 B
C

/*
!!DESCRIPTION!! Getting the size of a void-type variable (cc65 extension)
!!ORIGIN!! cc65 regression tests
!!LICENCE!! Public Domain
!!AUTHOR!! Greg King
*/
static const void list1 = {
(char)1,
(char)2,
(char)3,
(char)4,
(char)5,
(char)6,
(char)7,
(char)8,
(char)9,
(char)0
};
static void list2 = {
1,
2,
3,
4,
5,
6,
7,
8,
9,
0
};
void list3 = {
(char)1,
(char)2,
(char)3,
(char)4,
&list1,
(char)6,
(char)7,
(char)8,
(char)9,
&list2
};
/* We know that the expression is constant; don't tell us. */
#pragma warn (const-comparison, off)
int main (void)
{
return sizeof list1 != 10
|| sizeof list2 != 20
|| sizeof list3 != 12;
}