This revision was automatically updated to reflect the committed changes. Closed by commit rL362701: [clang-tidy] Fix an assertion failure in misc-redundant-expression. (authored by hokein, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D62947?vs=203331&id=203336#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62947/new/ https://reviews.llvm.org/D62947 Files: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp Index: clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp +++ clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp @@ -725,3 +725,15 @@ #undef FLAG1 #undef FLAG2 #undef FLAG3 + +namespace no_crash { +struct Foo {}; +bool operator<(const Foo&, const Foo&); +template <class T> +struct Bar { + static const Foo &GetFoo(); + static bool Test(const T & maybe_foo, const Foo& foo) { + return foo < GetFoo() && foo < maybe_foo; + } +}; +} Index: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp @@ -291,7 +291,7 @@ } AST_MATCHER(Expr, isIntegerConstantExpr) { - if (Node.isInstantiationDependent()) + if (Node.isInstantiationDependent() || Node.isValueDependent()) return false; return Node.isIntegerConstantExpr(Finder->getASTContext()); }
Index: clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp +++ clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp @@ -725,3 +725,15 @@ #undef FLAG1 #undef FLAG2 #undef FLAG3 + +namespace no_crash { +struct Foo {}; +bool operator<(const Foo&, const Foo&); +template <class T> +struct Bar { + static const Foo &GetFoo(); + static bool Test(const T & maybe_foo, const Foo& foo) { + return foo < GetFoo() && foo < maybe_foo; + } +}; +} Index: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp @@ -291,7 +291,7 @@ } AST_MATCHER(Expr, isIntegerConstantExpr) { - if (Node.isInstantiationDependent()) + if (Node.isInstantiationDependent() || Node.isValueDependent()) return false; return Node.isIntegerConstantExpr(Finder->getASTContext()); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits