[libcxx-commits] [libcxx] [libc++] add floating point type check for uniform real distribution (PR #70564)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 27 12:20:37 PST 2023


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/70564

>From ccf35dbb6f4a92d81c34655ed31456896050914c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CNhat?= <“nhat7203 at gmail.com”>
Date: Sat, 28 Oct 2023 14:30:43 -0400
Subject: [PATCH 1/7] add floating point type check for uniform real
 distrubtion

---
 .../__random/uniform_real_distribution.h      |  3 +++
 .../traits_mismatch.verify.cpp                | 21 +++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp

diff --git a/libcxx/include/__random/uniform_real_distribution.h b/libcxx/include/__random/uniform_real_distribution.h
index 1388cef95f39414..236075aaa185cf7 100644
--- a/libcxx/include/__random/uniform_real_distribution.h
+++ b/libcxx/include/__random/uniform_real_distribution.h
@@ -12,6 +12,7 @@
 #include <__config>
 #include <__random/generate_canonical.h>
 #include <__random/is_valid.h>
+#include <__type_traits/is_floating_point.h>
 #include <iosfwd>
 #include <limits>
 
@@ -27,6 +28,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS uniform_real_distribution
 {
+  static_assert(is_floating_point<_RealType>::value, "result_type must be floating type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
new file mode 100644
index 000000000000000..1f36af6dcd4c27c
--- /dev/null
+++ b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<_RealType = double>
+// class uniform_real_distribution;
+
+// result_type must be floating type, int type is unsupported
+
+#include <random>
+
+struct test_random : public std::uniform_real_distribution<int> {};
+
+// expected-error@*:* {{static assertion failed due to requirement
+// 'is_floating_point<int>::value': result_type must be floating type}}

>From 19c47c3f4a91c86f833efbe56fb427a5edf2c5fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CNhat?= <“nhat7203 at gmail.com”>
Date: Sun, 5 Nov 2023 12:50:36 -0500
Subject: [PATCH 2/7] fix format

---
 .../random/random.uniform.real/traits_mismatch.verify.cpp      | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
index 1f36af6dcd4c27c..860200e3868b159 100644
--- a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
+++ b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
@@ -17,5 +17,4 @@
 
 struct test_random : public std::uniform_real_distribution<int> {};
 
-// expected-error@*:* {{static assertion failed due to requirement
-// 'is_floating_point<int>::value': result_type must be floating type}}
+// expected-error@*:* {{static assertion failed due to requirement 'is_floating_point<int>::value': result_type must be floating type}}

>From 78a7b60aec80453c8ca5486b0d157ba97e8b28c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CNhat?= <“nhat7203 at gmail.com”>
Date: Sat, 25 Nov 2023 02:50:51 -0500
Subject: [PATCH 3/7] use static assert from is_valid

---
 libcxx/include/__random/is_valid.h                 | 14 ++++++++++++++
 .../include/__random/uniform_real_distribution.h   |  4 ++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/__random/is_valid.h b/libcxx/include/__random/is_valid.h
index 113452bc5d35aa2..bde4733099d6884 100644
--- a/libcxx/include/__random/is_valid.h
+++ b/libcxx/include/__random/is_valid.h
@@ -23,6 +23,20 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+// [rand.req.genl]/1.4:
+// The effect of instantiating a template that has a template type parameter
+// named RealType is undefined unless the corresponding template argument is
+// cv-unqualified and is one of float, double, or long double.
+
+template <class>
+struct __libcpp_random_is_valid_realtype : false_type {};
+template <>
+struct __libcpp_random_is_valid_realtype<float> : true_type {};
+template <>
+struct __libcpp_random_is_valid_realtype<double> : true_type {};
+template <>
+struct __libcpp_random_is_valid_realtype<long double> : true_type {};
+
 // [rand.req.genl]/1.5:
 // The effect of instantiating a template that has a template type parameter
 // named IntType is undefined unless the corresponding template argument is
diff --git a/libcxx/include/__random/uniform_real_distribution.h b/libcxx/include/__random/uniform_real_distribution.h
index 236075aaa185cf7..48baa951388be76 100644
--- a/libcxx/include/__random/uniform_real_distribution.h
+++ b/libcxx/include/__random/uniform_real_distribution.h
@@ -12,7 +12,6 @@
 #include <__config>
 #include <__random/generate_canonical.h>
 #include <__random/is_valid.h>
-#include <__type_traits/is_floating_point.h>
 #include <iosfwd>
 #include <limits>
 
@@ -28,7 +27,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS uniform_real_distribution
 {
-  static_assert(is_floating_point<_RealType>::value, "result_type must be floating type");
+  static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+                "RealType must be a supported floating-point type");
 
 public:
     // types

>From 0eddc50e29fd20f7c25b604146e12a12ab729107 Mon Sep 17 00:00:00 2001
From: Nhat Nguyen <35616780+changkhothuychung at users.noreply.github.com>
Date: Sat, 25 Nov 2023 02:54:10 -0500
Subject: [PATCH 4/7] Update
 libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp

Co-authored-by: Mark de Wever <zar-rpg at xs4all.nl>
---
 .../random/random.uniform.real/traits_mismatch.verify.cpp      | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
index 860200e3868b159..f87067ca64b9821 100644
--- a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
+++ b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
@@ -15,6 +15,5 @@
 
 #include <random>
 
-struct test_random : public std::uniform_real_distribution<int> {};
-
 // expected-error@*:* {{static assertion failed due to requirement 'is_floating_point<int>::value': result_type must be floating type}}
+struct test_random : public std::uniform_real_distribution<int> {};

>From 73bd6aeb4cd9cddf249fffc4d9d25ea6d9202d4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CNhat?= <“nhat7203 at gmail.com”>
Date: Sat, 25 Nov 2023 03:04:49 -0500
Subject: [PATCH 5/7] fix test file

---
 .../random/random.uniform.real/traits_mismatch.verify.cpp       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
index f87067ca64b9821..bc84e362034ccd7 100644
--- a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
+++ b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
@@ -15,5 +15,5 @@
 
 #include <random>
 
-// expected-error@*:* {{static assertion failed due to requirement 'is_floating_point<int>::value': result_type must be floating type}}
+// expected-error@*:* {{static assertion failed due to requirement '__libcpp_random_is_valid_realtype<int>::value': RealType must be a supported floating-point type}}
 struct test_random : public std::uniform_real_distribution<int> {};

>From 1492607dbbe63af017af958e2f4e2d9bc2b2ca9b Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 27 Nov 2023 10:02:48 -0500
Subject: [PATCH 6/7] Add test and fix for other Real distributions

---
 libcxx/include/__random/cauchy_distribution.h |   3 +
 .../__random/chi_squared_distribution.h       |   3 +
 .../__random/exponential_distribution.h       |   3 +
 .../__random/extreme_value_distribution.h     |   3 +
 .../include/__random/fisher_f_distribution.h  |   3 +
 libcxx/include/__random/gamma_distribution.h  |   3 +
 .../include/__random/lognormal_distribution.h |   3 +
 libcxx/include/__random/normal_distribution.h |   3 +
 .../piecewise_constant_distribution.h         |   3 +
 .../__random/piecewise_linear_distribution.h  |   3 +
 .../include/__random/student_t_distribution.h |   3 +
 .../include/__random/weibull_distribution.h   |   3 +
 .../rand.req.urng/valid_real_type.verify.cpp  | 109 ++++++++++++++++++
 .../traits_mismatch.verify.cpp                |  19 ---
 14 files changed, 145 insertions(+), 19 deletions(-)
 create mode 100644 libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_real_type.verify.cpp
 delete mode 100644 libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp

diff --git a/libcxx/include/__random/cauchy_distribution.h b/libcxx/include/__random/cauchy_distribution.h
index 2fda6b53837673d..815d8e2b23f4bb2 100644
--- a/libcxx/include/__random/cauchy_distribution.h
+++ b/libcxx/include/__random/cauchy_distribution.h
@@ -28,6 +28,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS cauchy_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+            "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/chi_squared_distribution.h b/libcxx/include/__random/chi_squared_distribution.h
index f2922b64dd6cfce..0782aa87111aea8 100644
--- a/libcxx/include/__random/chi_squared_distribution.h
+++ b/libcxx/include/__random/chi_squared_distribution.h
@@ -26,6 +26,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS chi_squared_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+            "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/exponential_distribution.h b/libcxx/include/__random/exponential_distribution.h
index b33b072eca08516..43644f7b8e20bc1 100644
--- a/libcxx/include/__random/exponential_distribution.h
+++ b/libcxx/include/__random/exponential_distribution.h
@@ -29,6 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS exponential_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+                "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/extreme_value_distribution.h b/libcxx/include/__random/extreme_value_distribution.h
index c583ec06a314a03..63899244731b149 100644
--- a/libcxx/include/__random/extreme_value_distribution.h
+++ b/libcxx/include/__random/extreme_value_distribution.h
@@ -28,6 +28,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS extreme_value_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+                "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/fisher_f_distribution.h b/libcxx/include/__random/fisher_f_distribution.h
index b757607bc461f4a..7e59f9e45f71b7a 100644
--- a/libcxx/include/__random/fisher_f_distribution.h
+++ b/libcxx/include/__random/fisher_f_distribution.h
@@ -27,6 +27,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS fisher_f_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+            "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/gamma_distribution.h b/libcxx/include/__random/gamma_distribution.h
index 777f6b5c76d5680..de05293d64ce936 100644
--- a/libcxx/include/__random/gamma_distribution.h
+++ b/libcxx/include/__random/gamma_distribution.h
@@ -29,6 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS gamma_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+                "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/lognormal_distribution.h b/libcxx/include/__random/lognormal_distribution.h
index 1e8ac39dbac0319..fbec599ee10e933 100644
--- a/libcxx/include/__random/lognormal_distribution.h
+++ b/libcxx/include/__random/lognormal_distribution.h
@@ -27,6 +27,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS lognormal_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+                "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/normal_distribution.h b/libcxx/include/__random/normal_distribution.h
index e2bf041b71fe2cd..36f44fd9f16d71d 100644
--- a/libcxx/include/__random/normal_distribution.h
+++ b/libcxx/include/__random/normal_distribution.h
@@ -28,6 +28,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS normal_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+                "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/piecewise_constant_distribution.h b/libcxx/include/__random/piecewise_constant_distribution.h
index 5b26ab65e63f729..e88f09a3b984870 100644
--- a/libcxx/include/__random/piecewise_constant_distribution.h
+++ b/libcxx/include/__random/piecewise_constant_distribution.h
@@ -29,6 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS piecewise_constant_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+            "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/piecewise_linear_distribution.h b/libcxx/include/__random/piecewise_linear_distribution.h
index 6be44b29fcc8400..f94ad5b13e1cb7e 100644
--- a/libcxx/include/__random/piecewise_linear_distribution.h
+++ b/libcxx/include/__random/piecewise_linear_distribution.h
@@ -29,6 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS piecewise_linear_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+            "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/student_t_distribution.h b/libcxx/include/__random/student_t_distribution.h
index 2d2be23657ae0b2..d70f70398578f54 100644
--- a/libcxx/include/__random/student_t_distribution.h
+++ b/libcxx/include/__random/student_t_distribution.h
@@ -29,6 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS student_t_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+            "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/include/__random/weibull_distribution.h b/libcxx/include/__random/weibull_distribution.h
index df834e6557c835f..cda5d585004f932 100644
--- a/libcxx/include/__random/weibull_distribution.h
+++ b/libcxx/include/__random/weibull_distribution.h
@@ -27,6 +27,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS weibull_distribution
 {
+    static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
+                "RealType must be a supported floating-point type");
+
 public:
     // types
     typedef _RealType result_type;
diff --git a/libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_real_type.verify.cpp b/libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_real_type.verify.cpp
new file mode 100644
index 000000000000000..6c6a109227df9f6
--- /dev/null
+++ b/libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_real_type.verify.cpp
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+#include <random>
+
+void test() {
+  {
+    std::uniform_real_distribution<int>
+        baddist; //expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::uniform_real_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+  {
+    std::exponential_distribution<int>
+        baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::exponential_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::gamma_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::gamma_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::weibull_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::weibull_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::extreme_value_distribution<int>
+        baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::extreme_value_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::normal_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::normal_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::lognormal_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::lognormal_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::chi_squared_distribution<int>
+        baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::chi_squared_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::cauchy_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::cauchy_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::fisher_f_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::fisher_f_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::student_t_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::student_t_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::piecewise_constant_distribution<int>
+        baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::piecewise_constant_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+
+  {
+    std::piecewise_linear_distribution<int>
+        baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+    std::piecewise_linear_distribution<double> okdist;
+    (void)baddist;
+    (void)okdist;
+  }
+}
diff --git a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp b/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
deleted file mode 100644
index bc84e362034ccd7..000000000000000
--- a/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <random>
-
-// template<_RealType = double>
-// class uniform_real_distribution;
-
-// result_type must be floating type, int type is unsupported
-
-#include <random>
-
-// expected-error@*:* {{static assertion failed due to requirement '__libcpp_random_is_valid_realtype<int>::value': RealType must be a supported floating-point type}}
-struct test_random : public std::uniform_real_distribution<int> {};

>From a6b7b6bd9b40b0b450ffd421245bbb1e9081e0eb Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 27 Nov 2023 14:41:00 -0500
Subject: [PATCH 7/7] Add missing includes

---
 libcxx/include/__random/chi_squared_distribution.h | 1 +
 libcxx/include/__random/lognormal_distribution.h   | 1 +
 libcxx/include/__random/weibull_distribution.h     | 1 +
 3 files changed, 3 insertions(+)

diff --git a/libcxx/include/__random/chi_squared_distribution.h b/libcxx/include/__random/chi_squared_distribution.h
index 0782aa87111aea8..5164b600abe4d1d 100644
--- a/libcxx/include/__random/chi_squared_distribution.h
+++ b/libcxx/include/__random/chi_squared_distribution.h
@@ -11,6 +11,7 @@
 
 #include <__config>
 #include <__random/gamma_distribution.h>
+#include <__random/is_valid.h>
 #include <iosfwd>
 #include <limits>
 
diff --git a/libcxx/include/__random/lognormal_distribution.h b/libcxx/include/__random/lognormal_distribution.h
index fbec599ee10e933..ad5a40342bd7e68 100644
--- a/libcxx/include/__random/lognormal_distribution.h
+++ b/libcxx/include/__random/lognormal_distribution.h
@@ -10,6 +10,7 @@
 #define _LIBCPP___RANDOM_LOGNORMAL_DISTRIBUTION_H
 
 #include <__config>
+#include <__random/is_valid.h>
 #include <__random/normal_distribution.h>
 #include <cmath>
 #include <iosfwd>
diff --git a/libcxx/include/__random/weibull_distribution.h b/libcxx/include/__random/weibull_distribution.h
index cda5d585004f932..e1a4ee05f5cc521 100644
--- a/libcxx/include/__random/weibull_distribution.h
+++ b/libcxx/include/__random/weibull_distribution.h
@@ -11,6 +11,7 @@
 
 #include <__config>
 #include <__random/exponential_distribution.h>
+#include <__random/is_valid.h>
 #include <cmath>
 #include <iosfwd>
 #include <limits>



More information about the libcxx-commits mailing list