forked from OSchip/llvm-project
[clang-tidy] Fix an assertion failure in misc-redundant-expression.
Summary: The assertion "isIntegerConstantExpr" is triggered in the isIntegerConstantExpr(), we should not call it if the expression is value dependent. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62947 llvm-svn: 362701
This commit is contained in:
parent
559e69a821
commit
df95e6109e
|
@ -291,7 +291,7 @@ static void transformSubToCanonicalAddExpr(BinaryOperatorKind &Opcode,
|
|||
}
|
||||
|
||||
AST_MATCHER(Expr, isIntegerConstantExpr) {
|
||||
if (Node.isInstantiationDependent())
|
||||
if (Node.isInstantiationDependent() || Node.isValueDependent())
|
||||
return false;
|
||||
return Node.isIntegerConstantExpr(Finder->getASTContext());
|
||||
}
|
||||
|
|
|
@ -725,3 +725,15 @@ int operatorConfusion(int X, int Y, long Z)
|
|||
#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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue