File: typed-enum.c

package info (click to toggle)
sdcc 4.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 112,804 kB
  • sloc: ansic: 622,685; cpp: 259,454; makefile: 81,253; sh: 40,203; asm: 19,222; perl: 12,139; yacc: 7,761; awk: 3,378; lisp: 1,677; python: 1,097; lex: 1,028; sed: 76
file content (53 lines) | stat: -rw-r--r-- 862 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

#ifdef TEST1
#ifdef __SDCC
_Pragma("std_c23")
#endif

enum /* no tag */ : char { A }; /* OK */
enum tag1 : int;                /* OK */
enum tag2 : const int;          /* OK */
enum tag3 : unsigned short;     /* OK */
enum tag4 : float;              /* ERROR */

#endif


#ifdef TEST2
#ifdef __SDCC
_Pragma("std_c23")
#endif

enum tag1 : int { A };          /* OK */
enum tag2 : struct { int a; };  /* ERROR */

#endif


#ifdef TEST3
#ifdef __SDCC
_Pragma("std_c23")
#endif

typedef int my_int;
typedef struct { int a; } my_struct;

enum tag1 : my_int;             /* OK */
enum tag2 : my_struct;          /* ERROR */

#endif


#ifdef TEST4
#ifdef __SDCC
_Pragma("std_c23")
#endif

typedef struct { int a; } my_struct;
typedef enum : char { A } my_enum;
my_struct s;

enum tag1 : typeof(s.a);        /* OK */
enum tag2 : my_enum;            /* ERROR */

#endif