Test compiling enums

It turns out the enumerator type and enum type wind up with different
instances of the same type (due to the way type chaining works). This
results in infinite recursion in assign_expr and check_types_compatible.
This commit is contained in:
Bill Currie 2019-06-10 07:17:41 +09:00
parent ef4ad52239
commit f81484a068
2 changed files with 22 additions and 0 deletions

View file

@ -33,6 +33,7 @@ test_progs_dat=\
chewed-return.dat \
comma-expr.dat \
deadbool.dat \
enum.dat \
fordecl.dat \
func-expr.dat \
func-static.dat \
@ -109,6 +110,15 @@ deadbool.run: Makefile build-run
include ./$(DEPDIR)/deadbool.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/deadbool.Qo
enum_dat_SOURCES=enum.r
enum_obj=$(enum_dat_SOURCES:.r=.qfo)
enum.dat$(EXEEXT): $(enum_obj) $(QFCC_DEP)
$(QFCC) $(QCFLAGS) -o $@ $(enum_obj)
enum.run: Makefile build-run
$(srcdir)/build-run $@
include ./$(DEPDIR)/enum.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/enum.Qo
fordecl_dat_SOURCES=fordecl.r
fordecl_obj=$(fordecl_dat_SOURCES:.r=.qfo)
fordecl.dat$(EXEEXT): $(fordecl_obj) $(QFCC_DEP)

12
tools/qfcc/test/enum.r Normal file
View file

@ -0,0 +1,12 @@
typedef enum {
NO = 0,
YES
} BOOL;
int
main()
{
BOOL b;
b = YES;
return !b;
}