diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-04-22 10:51:28 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-04-22 10:51:32 +0200 |
commit | 414d9f47f3c7e247c9ecaea9b045a7ee0cb8a371 (patch) | |
tree | 28c8c86e609fd958fd74c44cfeb198259b88e12c | |
parent | 259f20b3d7b43fa97f4a611aa727c65095d776c6 (diff) | |
download | sigc++-414d9f47f3c7e247c9ecaea9b045a7ee0cb8a371.tar.gz |
tests: Make single argument constructors explicit.
Found by the google-explicit-constructor clang-tidy check.
-rw-r--r-- | tests/test_bind.cc | 2 | ||||
-rw-r--r-- | tests/test_bind_ref.cc | 2 | ||||
-rw-r--r-- | tests/test_bind_refptr.cc | 2 | ||||
-rw-r--r-- | tests/test_bind_return.cc | 2 | ||||
-rw-r--r-- | tests/test_track_obj.cc | 2 | ||||
-rw-r--r-- | tests/test_visit_each.cc | 4 |
6 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_bind.cc b/tests/test_bind.cc index 44e0c2e..949d052 100644 --- a/tests/test_bind.cc +++ b/tests/test_bind.cc @@ -68,7 +68,7 @@ egon(std::string& str) struct book : public sigc::trackable { - book(const std::string& name) : name_(name) {} + explicit book(const std::string& name) : name_(name) {} // non-copyable: book(const book&) = delete; diff --git a/tests/test_bind_ref.cc b/tests/test_bind_ref.cc index a83fbae..fd1fb4e 100644 --- a/tests/test_bind_ref.cc +++ b/tests/test_bind_ref.cc @@ -16,7 +16,7 @@ std::ostringstream result_stream; class Param : public sigc::trackable { public: - Param(const std::string& name) : name_(name) {} + explicit Param(const std::string& name) : name_(name) {} // non-copyable, // so it can only be used with sigc::bind() via sigc::ref() diff --git a/tests/test_bind_refptr.cc b/tests/test_bind_refptr.cc index 062cb7d..8bc59b8 100644 --- a/tests/test_bind_refptr.cc +++ b/tests/test_bind_refptr.cc @@ -86,7 +86,7 @@ public: * Increments the reference count. */ template <typename T_CastFrom> - inline RefPtr(const RefPtr<T_CastFrom>& src); + inline explicit RefPtr(const RefPtr<T_CastFrom>& src); /** Swap the contents of two RefPtr<>. * This method swaps the internal pointers to T_CppObject. This can be diff --git a/tests/test_bind_return.cc b/tests/test_bind_return.cc index 7aa38a7..bb224bc 100644 --- a/tests/test_bind_return.cc +++ b/tests/test_bind_return.cc @@ -27,7 +27,7 @@ struct foo struct bar : public sigc::trackable { - bar(int i = 0) : i_(i) {} + explicit bar(int i = 0) : i_(i) {} operator int() { return i_; } int i_; }; diff --git a/tests/test_track_obj.cc b/tests/test_track_obj.cc index 46f432e..2d29f4b 100644 --- a/tests/test_track_obj.cc +++ b/tests/test_track_obj.cc @@ -62,7 +62,7 @@ class Functor1 public: using result_type = std::string; - Functor1(const bar_group4& bar) : bar_(bar) {} + explicit Functor1(const bar_group4& bar) : bar_(bar) {} std::string operator()(int i) { return (i < 0) ? "negative" : ((i > 0) ? "positive" : "zero"); } diff --git a/tests/test_visit_each.cc b/tests/test_visit_each.cc index ade8337..0d081d1 100644 --- a/tests/test_visit_each.cc +++ b/tests/test_visit_each.cc @@ -59,7 +59,7 @@ namespace class MyClass1 : public sigc::trackable { public: - MyClass1(const std::string& str) : s(str) {} + explicit MyClass1(const std::string& str) : s(str) {} void execute(int i) { result_stream << s << i; } private: @@ -69,7 +69,7 @@ private: class MyClass2 : public ns_ext::NsExtClass, public sigc::trackable { public: - MyClass2(const std::string& str) : s(str) {} + explicit MyClass2(const std::string& str) : s(str) {} void execute(int i) { result_stream << s << i; } private: |