зеркало из https://github.com/microsoft/STL.git
Standard Library Modules: Add compiler workarounds for `<random>` (#4906)
This commit is contained in:
Родитель
5f119276ac
Коммит
138e1161c9
|
@ -707,9 +707,9 @@ struct _Unsigned128 : _Base128 {
|
|||
using _Signed_type = _Signed128;
|
||||
using _Unsigned_type = _Unsigned128;
|
||||
|
||||
#if !_HAS_CXX17
|
||||
#if !_HAS_CXX17 || (_HAS_CXX20 && !defined(__clang__) && !defined(__EDG__)) // TRANSITION, DevCom-10729775
|
||||
constexpr _Unsigned128() noexcept : _Base128{} {}
|
||||
#endif // !_HAS_CXX17
|
||||
#endif // ^^^ workaround for C++20 MSVC modules and header units; should be guarded for !_HAS_CXX17 only ^^^
|
||||
|
||||
using _Base128::_Base128;
|
||||
constexpr explicit _Unsigned128(const _Base128& _That) noexcept : _Base128{_That} {}
|
||||
|
@ -1024,9 +1024,9 @@ struct _Signed128 : _Base128 {
|
|||
using _Signed_type = _Signed128;
|
||||
using _Unsigned_type = _Unsigned128;
|
||||
|
||||
#if !_HAS_CXX17
|
||||
#if !_HAS_CXX17 || (_HAS_CXX20 && !defined(__clang__) && !defined(__EDG__)) // TRANSITION, DevCom-10729775
|
||||
constexpr _Signed128() noexcept : _Base128{} {}
|
||||
#endif // !_HAS_CXX17
|
||||
#endif // ^^^ workaround for C++20 MSVC modules and header units; should be guarded for !_HAS_CXX17 only ^^^
|
||||
|
||||
using _Base128::_Base128;
|
||||
constexpr explicit _Signed128(const _Base128& _That) noexcept : _Base128{_That} {}
|
||||
|
|
|
@ -593,6 +593,14 @@ void test_random() {
|
|||
minstd_rand0 lcg;
|
||||
lcg.discard(9999);
|
||||
assert(lcg() == 1043618065); // N4868 [rand.predef]/1
|
||||
|
||||
#ifndef _MSVC_INTERNAL_TESTING // TRANSITION, VSO-2226569
|
||||
// Test coverage for GH-4899 "Standard Library Modules: uniform_real_distribution emits
|
||||
// error C2512: 'std::_Unsigned128': no appropriate default constructor available":
|
||||
const double val = generate_canonical<double, 53>(lcg);
|
||||
assert(val >= 0.0);
|
||||
assert(val < 1.0);
|
||||
#endif // ^^^ no workaround ^^^
|
||||
}
|
||||
|
||||
void test_ranges() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче