When testing for anyOf(), the test should not be for an exact type match for all members of the set. Instead, test that all members are convertible to the common type.
llvm-svn: 241263
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index 2c482e3..b6ef822 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -114,9 +114,9 @@
assert(InnerMatchers.size() > 0 && "Array must not be empty.");
assert(std::all_of(InnerMatchers.begin(), InnerMatchers.end(),
[&InnerMatchers](const DynTypedMatcher &M) {
- return InnerMatchers[0].SupportedKind.isSame(M.SupportedKind);
+ return InnerMatchers[0].canConvertTo(M.SupportedKind);
}) &&
- "SupportedKind must match!");
+ "SupportedKind must be convertible to a common type!");
auto SupportedKind = InnerMatchers[0].SupportedKind;
// We must relax the restrict kind here.