mirror of
https://github.com/rui314/chibicc
synced 2024-11-22 22:31:18 +03:00
a6b82da1ae
In the following example, `x` is defined as an alias for `int`. typedef x; Below is valid C code where the second `t` is a local variable of type int having value 3. typedef int t; t t = 3;
18 lines
469 B
C
18 lines
469 B
C
#include "test.h"
|
|
|
|
typedef int MyInt, MyInt2[4];
|
|
typedef int;
|
|
|
|
int main() {
|
|
ASSERT(1, ({ typedef int t; t x=1; x; }));
|
|
ASSERT(1, ({ typedef struct {int a;} t; t x; x.a=1; x.a; }));
|
|
ASSERT(1, ({ typedef int t; t t=1; t; }));
|
|
ASSERT(2, ({ typedef struct {int a;} t; { typedef int t; } t x; x.a=2; x.a; }));
|
|
ASSERT(4, ({ typedef t; t x; sizeof(x); }));
|
|
ASSERT(3, ({ MyInt x=3; x; }));
|
|
ASSERT(16, ({ MyInt2 x; sizeof(x); }));
|
|
|
|
printf("OK\n");
|
|
return 0;
|
|
}
|