summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2016-12-30 13:25:03 +0000
committerAlexander Kornienko <alexfh@google.com>2016-12-30 13:25:03 +0000
commit56d0806644f37abc26d5ea9abf91114e52cd3fa7 (patch)
treed345574615cbb17d75ae0291cb36065f4934e082 /clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp
parent03226c5e0632268ffc778414ecb421fccead4367 (diff)
downloadbcm5719-llvm-56d0806644f37abc26d5ea9abf91114e52cd3fa7.tar.gz
bcm5719-llvm-56d0806644f37abc26d5ea9abf91114e52cd3fa7.zip
[clang-tidy] google-explicit-constructor: ignore template instantiations
llvm-svn: 290753
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp b/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp
index 6cc3435b9b8..aac6ab62bd2 100644
--- a/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp
+++ b/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp
@@ -138,3 +138,35 @@ void f(std::initializer_list<int> list) {
E<decltype(list)> e(list);
E<int> e2(list);
}
+
+template <typename T>
+struct F {};
+
+template<typename T>
+struct G {
+ operator bool() const;
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator bool' must be marked
+ // CHECK-FIXES: {{^}} explicit operator bool() const;
+ operator F<T>() const;
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator F<type-parameter-0-0>' must be marked
+ // CHECK-FIXES: {{^}} explicit operator F<T>() const;
+ template<typename U>
+ operator F<U>*() const;
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator F<type-parameter-1-0> *' must be marked
+ // CHECK-FIXES: {{^}} explicit operator F<U>*() const;
+};
+
+void f2() {
+ G<int> a;
+ (void)(F<int>)a;
+ if (a) {}
+ (void)(F<int>*)a;
+ (void)(F<int*>*)a;
+
+ G<double> b;
+ (void)(F<double>)b;
+ if (b) {}
+ (void)(F<double>*)b;
+ (void)(F<double*>*)b;
+
+}
OpenPOWER on IntegriCloud