diff options
| author | Michael Matz <matz@suse.de> | 2016-08-07 00:09:10 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:10 +0100 |
| commit | b1a906b970e1f55c1a3e6786cddb08719216ade3 (patch) | |
| tree | c83b08e02bf0ff39e12d3fe500ebea69539d27dd /tccgen.c | |
| parent | c0368604e196d53b281cd2aceb140b5facd36ed7 (diff) | |
| download | tinycc-b1a906b970e1f55c1a3e6786cddb08719216ade3.tar.gz tinycc-b1a906b970e1f55c1a3e6786cddb08719216ade3.tar.bz2 | |
enums and ints are compatible
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2565,6 +2565,14 @@ static int compare_types(CType *type1, CType *type2, int unqualified) t1 &= ~VT_DEFSIGN; t2 &= ~VT_DEFSIGN; } + if ((t1 & VT_BTYPE) == VT_ENUM) { + /* An enum is compatible with (unsigned) int. */ + t1 = VT_INT | (t1 & ~VT_BTYPE); + } + if ((t2 & VT_BTYPE) == VT_ENUM) { + /* An enum is compatible with (unsigned) int. */ + t2 = VT_INT | (t2 & ~VT_BTYPE); + } /* XXX: bitfields ? */ if (t1 != t2) return 0; |
