Index: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp @@ -557,7 +557,9 @@ if (ExprType.isNull()) ExprType = Obj->getType(); - assert(ExprType->isPointerType() && "Operator-> returned non-pointer type"); + if (!ExprType->isPointerType()) + return false; + // FIXME: This works around not having the location of the arrow operator. // Consider adding OperatorLoc to MemberExpr? SourceLocation ArrowLoc = Lexer::getLocForEndOfToken( Index: clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-assert-failure.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-assert-failure.cpp +++ clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-assert-failure.cpp @@ -0,0 +1,18 @@ +// RUN: clang-tidy %s -checks=-*,modernize-loop-convert -- + +// Note: this test expects no assert failure happened in clang-tidy. + +class LinguisticItem { + LinguisticItem *x0; + class x1 { + bool operator!= ( const x1 &; + operator* ( ; + LinguisticItem * &operator-> ( ; + operator++ ( + } begin() const; + x1 end() const { + LinguisticStream x2; + for (x1 x3 = x2.begin x3 != x2.end; ++x3) + x3->x0 + } +};