From b14dbd73b9d25673581e3b6c277d3453f0d3fa55 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 21 Dec 2010 07:22:56 +0000 Subject: Don't try to compute the value of a value-dependent expression when checking trivial comparisons. Fixes PR8795. llvm-svn: 122322 --- clang/lib/Sema/SemaChecking.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Sema/SemaChecking.cpp') diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c75b27c3ecc..75b30fcb769 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/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()) -- cgit v1.2.3