[libcxx-commits] [libcxx] [libc++] Make a few test helper constructors explicit (PR #118975)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 6 06:07:18 PST 2024


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/118975

None

>From e9e4ee9bf901d7f01e0319c308f011feae07c5b7 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 6 Dec 2024 09:06:47 -0500
Subject: [PATCH] [libc++] Make a few test helper constructors explicit

---
 libcxx/test/std/containers/sequences/vector/common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/test/std/containers/sequences/vector/common.h b/libcxx/test/std/containers/sequences/vector/common.h
index cd57b6cc3e7235..ff8147ef6b838b 100644
--- a/libcxx/test/std/containers/sequences/vector/common.h
+++ b/libcxx/test/std/containers/sequences/vector/common.h
@@ -20,7 +20,7 @@ struct throwing_t {
   int* throw_after_n_ = nullptr;
   throwing_t() { throw 0; }
 
-  throwing_t(int& throw_after_n) : throw_after_n_(&throw_after_n) {
+  explicit throwing_t(int& throw_after_n) : throw_after_n_(&throw_after_n) {
     if (throw_after_n == 0)
       throw 0;
     --throw_after_n;
@@ -95,7 +95,7 @@ struct throwing_iterator {
   int i_;
   T v_;
 
-  throwing_iterator(int i = 0, const T& v = T()) : i_(i), v_(v) {}
+  explicit throwing_iterator(int i = 0, const T& v = T()) : i_(i), v_(v) {}
 
   reference operator*() {
     if (i_ == 1)



More information about the libcxx-commits mailing list