summaryrefslogtreecommitdiff
path: root/support/valdiag/tests/typedef.c
blob: a24cbcc8bbb67717adc85031f960516ced4f49cc (plain) (blame)
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

#ifdef TEST1
typedef union {
  long l;
  float f;
} floatlong;

char func(char floatlong)
{
  return floatlong;
}
#endif

#ifdef TEST2
typedef union {
  long l;
  float f;
} floatlong;

long func(float x)
{
  typedef union {
    float f2;
    long l2;
    char c[4];
  } floatlong;
  floatlong fl;
  
  fl.f2=x;
  return fl.l2;
}
#endif

/* This is no longer an error in C11, so test with earlier standard. */
/* Unfortunately, GCC seems to accept this regardless. */
#ifdef TEST3_C99
typedef int I;		/* IGNORE */
typedef int I;		/* ERROR(SDCC) */
#endif

#ifdef TEST4
typedef int I;		/* IGNORE */
typedef char I;		/* ERROR */
#endif