diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-02-08 13:19:38 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-02-08 13:19:38 +0000 |
commit | 9524f2ccfe02886a6c211a475c66ebf82f1fbcad (patch) | |
tree | 4c5514e742e4575a90ac0dcf61ad478d2ac0979f /test | |
parent | 39e7ed25341e64e79d024f80e547b3e6558ac937 (diff) |
Merging r324514:
------------------------------------------------------------------------
r324514 | arphaman | 2018-02-07 21:45:39 +0100 (Wed, 07 Feb 2018) | 10 lines
[PR36008] Avoid -Wsign-compare warning for enum constants in
typeof expressions
This commit looks through typeof type at the original expression when diagnosing
-Wsign-compare to avoid an unfriendly diagnostic.
rdar://36588828
Differential Revision: https://reviews.llvm.org/D42561
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_60@324602 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Sema/compare.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Sema/compare.c b/test/Sema/compare.c index 7cd8adab89..b2b486f59f 100644 --- a/test/Sema/compare.c +++ b/test/Sema/compare.c @@ -391,3 +391,16 @@ typedef char two_chars[2]; void test12(unsigned a) { if (0 && -1 > a) { } } + +// PR36008 + +enum PR36008EnumTest { + kPR36008Value = 0, +}; + +void pr36008(enum PR36008EnumTest lhs) { + __typeof__(lhs) x = lhs; + __typeof__(kPR36008Value) y = (kPR36008Value); + if (x == y) x = y; // no warning + if (y == x) y = x; // no warning +} |