Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions stl/inc/utility
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,36 @@ struct _Tuple_size_sfinae<_Tuple, void_t<decltype(tuple_size<_Tuple>::value)>>
template <class _Tuple>
struct tuple_size<const _Tuple> : _Tuple_size_sfinae<_Tuple> {}; // ignore cv

// TRANSITION, DevCom-10948908, Clang fixed in 21: the [[deprecated]] attribute of a class template specialization
// has no effect
// See the specialization of tuple_size for volatile _Tuple
#if _HAS_CXX20 // vvv workaround vvv
template <class _Tuple>
struct _Tuple_size_sfinae<volatile _Tuple, void_t<decltype(tuple_size<_Tuple>::value)>>
: integral_constant<size_t, tuple_size<_Tuple>::value> {
_CXX20_DEPRECATE_VOLATILE static constexpr size_t value =
integral_constant<size_t, tuple_size<_Tuple>::value>::value;
};

template <class _Tuple>
struct _Tuple_size_sfinae<const volatile _Tuple, void_t<decltype(tuple_size<_Tuple>::value)>>
: integral_constant<size_t, tuple_size<_Tuple>::value> {
_CXX20_DEPRECATE_VOLATILE static constexpr size_t value =
integral_constant<size_t, tuple_size<_Tuple>::value>::value;
};

template <class _Tuple>
struct _CXX20_DEPRECATE_VOLATILE tuple_size<volatile _Tuple> : _Tuple_size_sfinae<volatile _Tuple> {};

template <class _Tuple>
struct _CXX20_DEPRECATE_VOLATILE tuple_size<const volatile _Tuple> : _Tuple_size_sfinae<const volatile _Tuple> {};
#else // ^^^ workaround / no workaround vvv
template <class _Tuple>
struct _CXX20_DEPRECATE_VOLATILE tuple_size<volatile _Tuple> : _Tuple_size_sfinae<_Tuple> {}; // ignore cv

template <class _Tuple>
struct _CXX20_DEPRECATE_VOLATILE tuple_size<const volatile _Tuple> : _Tuple_size_sfinae<_Tuple> {}; // ignore cv
#endif // ^^^ no workaround ^^^

template <size_t _Index, class _Tuple>
struct _MSVC_KNOWN_SEMANTICS tuple_element<_Index, const _Tuple> : tuple_element<_Index, _Tuple> {
Expand All @@ -628,15 +653,27 @@ struct _MSVC_KNOWN_SEMANTICS tuple_element<_Index, const _Tuple> : tuple_element
template <size_t _Index, class _Tuple>
struct _CXX20_DEPRECATE_VOLATILE _MSVC_KNOWN_SEMANTICS tuple_element<_Index, volatile _Tuple>
: tuple_element<_Index, _Tuple> {
// TRANSITION, DevCom-10948908, Clang fixed in 21: the [[deprecated]] attribute of a class template specialization
// has no effect
#if _HAS_CXX20 // vvv workaround vvv
using _Mybase _CXX20_DEPRECATE_VOLATILE = tuple_element<_Index, _Tuple>;
#else // ^^^ workaround / no workaround vvv
using _Mybase = tuple_element<_Index, _Tuple>;
using type = add_volatile_t<typename _Mybase::type>;
#endif // ^^^ no workaround ^^^
using type = add_volatile_t<typename _Mybase::type>;
};

template <size_t _Index, class _Tuple>
struct _CXX20_DEPRECATE_VOLATILE _MSVC_KNOWN_SEMANTICS tuple_element<_Index, const volatile _Tuple>
: tuple_element<_Index, _Tuple> {
// TRANSITION, DevCom-10948908, Clang fixed in 21: the [[deprecated]] attribute of a class template specialization
// has no effect
#if _HAS_CXX20 // vvv workaround vvv
using _Mybase _CXX20_DEPRECATE_VOLATILE = tuple_element<_Index, _Tuple>;
#else // ^^^ workaround / no workaround vvv
using _Mybase = tuple_element<_Index, _Tuple>;
using type = add_cv_t<typename _Mybase::type>;
#endif // ^^^ no workaround ^^^
using type = add_cv_t<typename _Mybase::type>;
};

template <class _Ty, size_t _Size>
Expand Down
30 changes: 28 additions & 2 deletions stl/inc/variant
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,21 @@ struct variant_size; // undefined
template <class _Ty>
struct variant_size<const _Ty> : variant_size<_Ty>::type {};
template <class _Ty>
struct _CXX20_DEPRECATE_VOLATILE variant_size<volatile _Ty> : variant_size<_Ty>::type {};
struct _CXX20_DEPRECATE_VOLATILE variant_size<volatile _Ty> : variant_size<_Ty>::type {
// TRANSITION, DevCom-10948908, Clang fixed in 21: the [[deprecated]] attribute of a class template specialization
// has no effect
#if _HAS_CXX20 // vvv workaround vvv
_CXX20_DEPRECATE_VOLATILE static constexpr size_t value = variant_size<_Ty>::type::value;
#endif // ^^^ no workaround ^^^
};
template <class _Ty>
struct _CXX20_DEPRECATE_VOLATILE variant_size<const volatile _Ty> : variant_size<_Ty>::type {};
struct _CXX20_DEPRECATE_VOLATILE variant_size<const volatile _Ty> : variant_size<_Ty>::type {
// TRANSITION, DevCom-10948908, Clang fixed in 21: the [[deprecated]] attribute of a class template specialization
// has no effect
#if _HAS_CXX20 // vvv workaround vvv
_CXX20_DEPRECATE_VOLATILE static constexpr size_t value = variant_size<_Ty>::type::value;
#endif // ^^^ no workaround ^^^
};
_EXPORT_STD template <class _Ty>
constexpr size_t variant_size_v = variant_size<_Ty>::value;

Expand All @@ -309,11 +321,25 @@ struct variant_alternative<_Idx, const _Ty> {
};
template <size_t _Idx, class _Ty>
struct _CXX20_DEPRECATE_VOLATILE variant_alternative<_Idx, volatile _Ty> {
// TRANSITION, DevCom-10948908, Clang fixed in 21: the [[deprecated]] attribute of a class template specialization
// has no effect
#if _HAS_CXX20 // vvv workaround vvv
using _Mybase _CXX20_DEPRECATE_VOLATILE = variant_alternative<_Idx, _Ty>;
using type = add_volatile_t<typename _Mybase::type>;
#else // ^^^ workaround / no workaround vvv
using type = add_volatile_t<variant_alternative_t<_Idx, _Ty>>;
#endif // ^^^ no workaround ^^^
};
template <size_t _Idx, class _Ty>
struct _CXX20_DEPRECATE_VOLATILE variant_alternative<_Idx, const volatile _Ty> {
// TRANSITION, DevCom-10948908, Clang fixed in 21: the [[deprecated]] attribute of a class template specialization
// has no effect
#if _HAS_CXX20 // vvv workaround vvv
using _Mybase _CXX20_DEPRECATE_VOLATILE = variant_alternative<_Idx, _Ty>;
using type = add_cv_t<typename _Mybase::type>;
#else // ^^^ workaround / no workaround vvv
using type = add_cv_t<variant_alternative_t<_Idx, _Ty>>;
#endif // ^^^ no workaround ^^^
};
template <size_t _Idx, class... _Types>
struct variant_alternative<_Idx, variant<_Types...>> {
Expand Down
194 changes: 194 additions & 0 deletions tests/std/expected_results.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,196 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# These tests are expected to fail under /WX

tests/P1831R1_cpp20_volatile:00 FAIL
tests/P1831R1_cpp20_volatile:01 FAIL
tests/P1831R1_cpp20_volatile:02 FAIL
tests/P1831R1_cpp20_volatile:03 FAIL
tests/P1831R1_cpp20_volatile:04 FAIL
tests/P1831R1_cpp20_volatile:05 FAIL
tests/P1831R1_cpp20_volatile:06 FAIL
tests/P1831R1_cpp20_volatile:07 FAIL
tests/P1831R1_cpp20_volatile:08 FAIL
tests/P1831R1_cpp20_volatile:09 FAIL
tests/P1831R1_cpp20_volatile:10 FAIL
tests/P1831R1_cpp20_volatile:11 FAIL
tests/P1831R1_cpp20_volatile:12 FAIL
tests/P1831R1_cpp20_volatile:13 FAIL
tests/P1831R1_cpp20_volatile:16 FAIL
tests/P1831R1_cpp20_volatile:17 FAIL
tests/P1831R1_cpp20_volatile:18 FAIL
tests/P1831R1_cpp20_volatile:19 FAIL
tests/P1831R1_cpp20_volatile:20 FAIL
tests/P1831R1_cpp20_volatile:21 FAIL
tests/P1831R1_cpp20_volatile:22 FAIL
tests/P1831R1_cpp20_volatile:29 FAIL
tests/P1831R1_cpp20_volatile:30 FAIL

tests/P1831R1_cpp20_volatile1:00 FAIL
tests/P1831R1_cpp20_volatile1:01 FAIL
tests/P1831R1_cpp20_volatile1:02 FAIL
tests/P1831R1_cpp20_volatile1:03 FAIL
tests/P1831R1_cpp20_volatile1:04 FAIL
tests/P1831R1_cpp20_volatile1:05 FAIL
tests/P1831R1_cpp20_volatile1:06 FAIL
tests/P1831R1_cpp20_volatile1:07 FAIL
tests/P1831R1_cpp20_volatile1:08 FAIL
tests/P1831R1_cpp20_volatile1:09 FAIL
tests/P1831R1_cpp20_volatile1:10 FAIL
tests/P1831R1_cpp20_volatile1:11 FAIL
tests/P1831R1_cpp20_volatile1:12 FAIL
tests/P1831R1_cpp20_volatile1:13 FAIL
tests/P1831R1_cpp20_volatile1:16 FAIL
tests/P1831R1_cpp20_volatile1:17 FAIL
tests/P1831R1_cpp20_volatile1:18 FAIL
tests/P1831R1_cpp20_volatile1:19 FAIL
tests/P1831R1_cpp20_volatile1:20 FAIL
tests/P1831R1_cpp20_volatile1:21 FAIL
tests/P1831R1_cpp20_volatile1:22 FAIL
tests/P1831R1_cpp20_volatile1:29 FAIL
tests/P1831R1_cpp20_volatile1:30 FAIL

tests/P1831R1_cpp20_volatile2:00 FAIL
tests/P1831R1_cpp20_volatile2:01 FAIL
tests/P1831R1_cpp20_volatile2:02 FAIL
tests/P1831R1_cpp20_volatile2:03 FAIL
tests/P1831R1_cpp20_volatile2:04 FAIL
tests/P1831R1_cpp20_volatile2:05 FAIL
tests/P1831R1_cpp20_volatile2:06 FAIL
tests/P1831R1_cpp20_volatile2:07 FAIL
tests/P1831R1_cpp20_volatile2:08 FAIL
tests/P1831R1_cpp20_volatile2:09 FAIL
tests/P1831R1_cpp20_volatile2:10 FAIL
tests/P1831R1_cpp20_volatile2:11 FAIL
tests/P1831R1_cpp20_volatile2:12 FAIL
tests/P1831R1_cpp20_volatile2:13 FAIL
tests/P1831R1_cpp20_volatile2:16 FAIL
tests/P1831R1_cpp20_volatile2:17 FAIL
tests/P1831R1_cpp20_volatile2:18 FAIL
tests/P1831R1_cpp20_volatile2:19 FAIL
tests/P1831R1_cpp20_volatile2:20 FAIL
tests/P1831R1_cpp20_volatile2:21 FAIL
tests/P1831R1_cpp20_volatile2:22 FAIL
tests/P1831R1_cpp20_volatile2:29 FAIL
tests/P1831R1_cpp20_volatile2:30 FAIL

tests/P1831R1_cpp20_volatile3:00 FAIL
tests/P1831R1_cpp20_volatile3:01 FAIL
tests/P1831R1_cpp20_volatile3:02 FAIL
tests/P1831R1_cpp20_volatile3:03 FAIL
tests/P1831R1_cpp20_volatile3:04 FAIL
tests/P1831R1_cpp20_volatile3:05 FAIL
tests/P1831R1_cpp20_volatile3:06 FAIL
tests/P1831R1_cpp20_volatile3:07 FAIL
tests/P1831R1_cpp20_volatile3:08 FAIL
tests/P1831R1_cpp20_volatile3:09 FAIL
tests/P1831R1_cpp20_volatile3:10 FAIL
tests/P1831R1_cpp20_volatile3:11 FAIL
tests/P1831R1_cpp20_volatile3:12 FAIL
tests/P1831R1_cpp20_volatile3:13 FAIL
tests/P1831R1_cpp20_volatile3:16 FAIL
tests/P1831R1_cpp20_volatile3:17 FAIL
tests/P1831R1_cpp20_volatile3:18 FAIL
tests/P1831R1_cpp20_volatile3:19 FAIL
tests/P1831R1_cpp20_volatile3:20 FAIL
tests/P1831R1_cpp20_volatile3:21 FAIL
tests/P1831R1_cpp20_volatile3:22 FAIL
tests/P1831R1_cpp20_volatile3:29 FAIL
tests/P1831R1_cpp20_volatile3:30 FAIL

tests/P1831R1_cpp20_volatile4:00 FAIL
tests/P1831R1_cpp20_volatile4:01 FAIL
tests/P1831R1_cpp20_volatile4:02 FAIL
tests/P1831R1_cpp20_volatile4:03 FAIL
tests/P1831R1_cpp20_volatile4:04 FAIL
tests/P1831R1_cpp20_volatile4:05 FAIL
tests/P1831R1_cpp20_volatile4:06 FAIL
tests/P1831R1_cpp20_volatile4:07 FAIL
tests/P1831R1_cpp20_volatile4:08 FAIL
tests/P1831R1_cpp20_volatile4:09 FAIL
tests/P1831R1_cpp20_volatile4:10 FAIL
tests/P1831R1_cpp20_volatile4:11 FAIL
tests/P1831R1_cpp20_volatile4:12 FAIL
tests/P1831R1_cpp20_volatile4:13 FAIL
tests/P1831R1_cpp20_volatile4:16 FAIL
tests/P1831R1_cpp20_volatile4:17 FAIL
tests/P1831R1_cpp20_volatile4:18 FAIL
tests/P1831R1_cpp20_volatile4:19 FAIL
tests/P1831R1_cpp20_volatile4:20 FAIL
tests/P1831R1_cpp20_volatile4:21 FAIL
tests/P1831R1_cpp20_volatile4:22 FAIL
tests/P1831R1_cpp20_volatile4:29 FAIL
tests/P1831R1_cpp20_volatile4:30 FAIL

tests/P1831R1_cpp20_volatile5:00 FAIL
tests/P1831R1_cpp20_volatile5:01 FAIL
tests/P1831R1_cpp20_volatile5:02 FAIL
tests/P1831R1_cpp20_volatile5:03 FAIL
tests/P1831R1_cpp20_volatile5:04 FAIL
tests/P1831R1_cpp20_volatile5:05 FAIL
tests/P1831R1_cpp20_volatile5:06 FAIL
tests/P1831R1_cpp20_volatile5:07 FAIL
tests/P1831R1_cpp20_volatile5:08 FAIL
tests/P1831R1_cpp20_volatile5:09 FAIL
tests/P1831R1_cpp20_volatile5:10 FAIL
tests/P1831R1_cpp20_volatile5:11 FAIL
tests/P1831R1_cpp20_volatile5:12 FAIL
tests/P1831R1_cpp20_volatile5:13 FAIL
tests/P1831R1_cpp20_volatile5:16 FAIL
tests/P1831R1_cpp20_volatile5:17 FAIL
tests/P1831R1_cpp20_volatile5:18 FAIL
tests/P1831R1_cpp20_volatile5:19 FAIL
tests/P1831R1_cpp20_volatile5:20 FAIL
tests/P1831R1_cpp20_volatile5:21 FAIL
tests/P1831R1_cpp20_volatile5:22 FAIL
tests/P1831R1_cpp20_volatile5:29 FAIL
tests/P1831R1_cpp20_volatile5:30 FAIL

tests/P1831R1_cpp20_volatile6:00 FAIL
tests/P1831R1_cpp20_volatile6:01 FAIL
tests/P1831R1_cpp20_volatile6:02 FAIL
tests/P1831R1_cpp20_volatile6:03 FAIL
tests/P1831R1_cpp20_volatile6:04 FAIL
tests/P1831R1_cpp20_volatile6:05 FAIL
tests/P1831R1_cpp20_volatile6:06 FAIL
tests/P1831R1_cpp20_volatile6:07 FAIL
tests/P1831R1_cpp20_volatile6:08 FAIL
tests/P1831R1_cpp20_volatile6:09 FAIL
tests/P1831R1_cpp20_volatile6:10 FAIL
tests/P1831R1_cpp20_volatile6:11 FAIL
tests/P1831R1_cpp20_volatile6:12 FAIL
tests/P1831R1_cpp20_volatile6:13 FAIL
tests/P1831R1_cpp20_volatile6:16 FAIL
tests/P1831R1_cpp20_volatile6:17 FAIL
tests/P1831R1_cpp20_volatile6:18 FAIL
tests/P1831R1_cpp20_volatile6:19 FAIL
tests/P1831R1_cpp20_volatile6:20 FAIL
tests/P1831R1_cpp20_volatile6:21 FAIL
tests/P1831R1_cpp20_volatile6:22 FAIL
tests/P1831R1_cpp20_volatile6:29 FAIL
tests/P1831R1_cpp20_volatile6:30 FAIL

tests/P1831R1_cpp20_volatile7:00 FAIL
tests/P1831R1_cpp20_volatile7:01 FAIL
tests/P1831R1_cpp20_volatile7:02 FAIL
tests/P1831R1_cpp20_volatile7:03 FAIL
tests/P1831R1_cpp20_volatile7:04 FAIL
tests/P1831R1_cpp20_volatile7:05 FAIL
tests/P1831R1_cpp20_volatile7:06 FAIL
tests/P1831R1_cpp20_volatile7:07 FAIL
tests/P1831R1_cpp20_volatile7:08 FAIL
tests/P1831R1_cpp20_volatile7:09 FAIL
tests/P1831R1_cpp20_volatile7:10 FAIL
tests/P1831R1_cpp20_volatile7:11 FAIL
tests/P1831R1_cpp20_volatile7:12 FAIL
tests/P1831R1_cpp20_volatile7:13 FAIL
tests/P1831R1_cpp20_volatile7:16 FAIL
tests/P1831R1_cpp20_volatile7:17 FAIL
tests/P1831R1_cpp20_volatile7:18 FAIL
tests/P1831R1_cpp20_volatile7:19 FAIL
tests/P1831R1_cpp20_volatile7:20 FAIL
tests/P1831R1_cpp20_volatile7:21 FAIL
tests/P1831R1_cpp20_volatile7:22 FAIL
tests/P1831R1_cpp20_volatile7:29 FAIL
tests/P1831R1_cpp20_volatile7:30 FAIL
8 changes: 8 additions & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,14 @@ tests\P1645R1_constexpr_numeric
tests\P1659R3_ranges_alg_ends_with
tests\P1659R3_ranges_alg_starts_with
tests\P1682R3_to_underlying
tests\P1831R1_cpp20_volatile
tests\P1831R1_cpp20_volatile1
tests\P1831R1_cpp20_volatile2
tests\P1831R1_cpp20_volatile3
tests\P1831R1_cpp20_volatile4
tests\P1831R1_cpp20_volatile5
tests\P1831R1_cpp20_volatile6
tests\P1831R1_cpp20_volatile7
tests\P1899R3_views_stride
tests\P1899R3_views_stride_death
tests\P1951R1_default_arguments_pair_forward_ctor
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P1831R1_cpp20_volatile/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_20_matrix.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <tuple>

int main() {
static_assert(std::tuple_size_v<volatile std::tuple<int>> == 1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <tuple>

int main() {
static_assert(std::tuple_size_v<const volatile std::tuple<int>> == 1);
}
4 changes: 4 additions & 0 deletions tests/std/tests/P1831R1_cpp20_volatile1/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_20_matrix.lst
4 changes: 4 additions & 0 deletions tests/std/tests/P1831R1_cpp20_volatile2/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_20_matrix.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <tuple>
#include <type_traits>

int main() {
static_assert(std::is_same_v<std::tuple_element_t<0, volatile std::tuple<int>>, volatile int>);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <tuple>
#include <type_traits>

int main() {
static_assert(std::is_same_v<std::tuple_element_t<0, const volatile std::tuple<int>>, const volatile int>);
}
4 changes: 4 additions & 0 deletions tests/std/tests/P1831R1_cpp20_volatile3/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_20_matrix.lst
4 changes: 4 additions & 0 deletions tests/std/tests/P1831R1_cpp20_volatile4/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_20_matrix.lst
Loading
Loading