forked from OSchip/llvm-project
[clang-tidy] google-explicit-constructor: don't match in template instantiations
This helps avoiding false positives related to the recently added std::initializer_list<> handling. llvm-svn: 222981
This commit is contained in:
parent
7432a64dcb
commit
ad5074df0c
|
@ -19,7 +19,8 @@ namespace clang {
|
|||
namespace tidy {
|
||||
|
||||
void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) {
|
||||
Finder->addMatcher(constructorDecl().bind("ctor"), this);
|
||||
Finder->addMatcher(constructorDecl(unless(isInstantiated())).bind("ctor"),
|
||||
this);
|
||||
}
|
||||
|
||||
// Looks for the token matching the predicate and returns the range of the found
|
||||
|
|
|
@ -78,3 +78,21 @@ struct C {
|
|||
C(const initializer_list<unsigned> &list2) {}
|
||||
C(initializer_list<unsigned> &&list3) {}
|
||||
};
|
||||
|
||||
struct D {
|
||||
template <typename T>
|
||||
explicit D(T t) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct E {
|
||||
explicit E(T t) {}
|
||||
template <typename U>
|
||||
explicit E(U u) {}
|
||||
};
|
||||
|
||||
void f(std::initializer_list<int> list) {
|
||||
D d(list);
|
||||
E<decltype(list)> e(list);
|
||||
E<int> e2(list);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue