diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-21 07:22:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-21 07:22:56 +0000 |
commit | 14af91a38c8cf89f0a5e1835d7d8e0fa220e17a9 (patch) | |
tree | 061b0e83ce7c847fa7fd9f5a11662b0e995bc713 /lib/Sema/SemaChecking.cpp | |
parent | 786e61717c67b513ed43e6e057a5ff550287ca47 (diff) |
Don't try to compute the value of a value-dependent expression when
checking trivial comparisons. Fixes PR8795.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122322 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index c75b27c3ec..75b30fcb76 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2527,6 +2527,9 @@ static bool HasEnumType(Expr *E) { void CheckTrivialUnsignedComparison(Sema &S, BinaryOperator *E) { BinaryOperatorKind op = E->getOpcode(); + if (E->isValueDependent()) + return; + if (op == BO_LT && IsZero(S, E->getRHS())) { S.Diag(E->getOperatorLoc(), diag::warn_lunsigned_always_true_comparison) << "< 0" << "false" << HasEnumType(E->getLHS()) |