Index: clang-tidy/modernize/LoopConvertUtils.cpp =================================================================== --- clang-tidy/modernize/LoopConvertUtils.cpp +++ 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: test/clang-tidy/modernize-loop-convert-assert-failure.cpp =================================================================== --- /dev/null +++ test/clang-tidy/modernize-loop-convert-assert-failure.cpp @@ -0,0 +1,16 @@ +// RUN: clang-tidy %s -checks=-*,modernize-loop-convert -- + +class LinguisticItem { + LinguisticItem *first_daughter; + class const_iterator { + bool operator!= ( const const_iterator &; + operator* ( ; + LinguisticItem * &operator-> ( ; + operator++ ( + } begin() const; + const_iterator end() const { + LinguisticStream a; + for (const_iterator b = a.begin; b != a.end; ++b) + b->first_daughter + } +};