Skip to content

Commit 8f711aa

Browse files
authored
[libc++][test] __cpp_lib_within_lifetime -> __cpp_lib_is_within_lifetime (llvm#91896)
The feature test macro was renamed when [P2641R4](https://wg21.link/P2641R4) was adopted into the standard: cplusplus/draft@0facada https://wg21.link/version.syn#lib:__cpp_lib_is_constant_evaluated
1 parent de483ad commit 8f711aa

File tree

5 files changed

+82
-80
lines changed

5 files changed

+82
-80
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ Status
436436
---------------------------------------------------------- -----------------
437437
``__cpp_lib_hazard_pointer`` *unimplemented*
438438
---------------------------------------------------------- -----------------
439+
``__cpp_lib_is_within_lifetime`` *unimplemented*
440+
---------------------------------------------------------- -----------------
439441
``__cpp_lib_linalg`` *unimplemented*
440442
---------------------------------------------------------- -----------------
441443
``__cpp_lib_out_ptr`` *unimplemented*
@@ -465,7 +467,5 @@ Status
465467
``__cpp_lib_to_chars`` *unimplemented*
466468
---------------------------------------------------------- -----------------
467469
``__cpp_lib_tuple_like`` *unimplemented*
468-
---------------------------------------------------------- -----------------
469-
``__cpp_lib_within_lifetime`` *unimplemented*
470470
========================================================== =================
471471

libcxx/include/version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ __cpp_lib_is_null_pointer 201309L <type_traits>
143143
__cpp_lib_is_pointer_interconvertible 201907L <type_traits>
144144
__cpp_lib_is_scoped_enum 202011L <type_traits>
145145
__cpp_lib_is_swappable 201603L <type_traits>
146+
__cpp_lib_is_within_lifetime 202306L <type_traits>
146147
__cpp_lib_jthread 201911L <stop_token> <thread>
147148
__cpp_lib_latch 201907L <latch>
148149
__cpp_lib_launder 201606L <new>
@@ -251,7 +252,6 @@ __cpp_lib_unreachable 202202L <utility>
251252
__cpp_lib_unwrap_ref 201811L <functional>
252253
__cpp_lib_variant 202102L <variant>
253254
__cpp_lib_void_t 201411L <type_traits>
254-
__cpp_lib_within_lifetime 202306L <type_traits>
255255
256256
*/
257257

@@ -520,6 +520,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
520520
// # define __cpp_lib_function_ref 202306L
521521
// # define __cpp_lib_generate_random 202403L
522522
// # define __cpp_lib_hazard_pointer 202306L
523+
// # define __cpp_lib_is_within_lifetime 202306L
523524
// # define __cpp_lib_linalg 202311L
524525
# undef __cpp_lib_out_ptr
525526
// # define __cpp_lib_out_ptr 202311L
@@ -538,7 +539,6 @@ __cpp_lib_within_lifetime 202306L <type_traits>
538539
// # define __cpp_lib_to_chars 202306L
539540
# undef __cpp_lib_tuple_like
540541
// # define __cpp_lib_tuple_like 202311L
541-
// # define __cpp_lib_within_lifetime 202306L
542542
#endif
543543

544544
// clang-format on

libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
__cpp_lib_is_pointer_interconvertible 201907L [C++20]
3131
__cpp_lib_is_scoped_enum 202011L [C++23]
3232
__cpp_lib_is_swappable 201603L [C++17]
33+
__cpp_lib_is_within_lifetime 202306L [C++26]
3334
__cpp_lib_logical_traits 201510L [C++17]
3435
__cpp_lib_reference_from_temporary 202202L [C++23]
3536
__cpp_lib_remove_cvref 201711L [C++20]
@@ -38,7 +39,6 @@
3839
__cpp_lib_type_identity 201806L [C++20]
3940
__cpp_lib_type_trait_variable_templates 201510L [C++17]
4041
__cpp_lib_void_t 201411L [C++17]
41-
__cpp_lib_within_lifetime 202306L [C++26]
4242
*/
4343

4444
#include <type_traits>
@@ -102,6 +102,10 @@
102102
# error "__cpp_lib_is_swappable should not be defined before c++17"
103103
# endif
104104

105+
# ifdef __cpp_lib_is_within_lifetime
106+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
107+
# endif
108+
105109
# ifdef __cpp_lib_logical_traits
106110
# error "__cpp_lib_logical_traits should not be defined before c++17"
107111
# endif
@@ -134,10 +138,6 @@
134138
# error "__cpp_lib_void_t should not be defined before c++17"
135139
# endif
136140

137-
# ifdef __cpp_lib_within_lifetime
138-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
139-
# endif
140-
141141
#elif TEST_STD_VER == 14
142142

143143
# ifdef __cpp_lib_bool_constant
@@ -205,6 +205,10 @@
205205
# error "__cpp_lib_is_swappable should not be defined before c++17"
206206
# endif
207207

208+
# ifdef __cpp_lib_is_within_lifetime
209+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
210+
# endif
211+
208212
# ifdef __cpp_lib_logical_traits
209213
# error "__cpp_lib_logical_traits should not be defined before c++17"
210214
# endif
@@ -243,10 +247,6 @@
243247
# error "__cpp_lib_void_t should not be defined before c++17"
244248
# endif
245249

246-
# ifdef __cpp_lib_within_lifetime
247-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
248-
# endif
249-
250250
#elif TEST_STD_VER == 17
251251

252252
# ifndef __cpp_lib_bool_constant
@@ -329,6 +329,10 @@
329329
# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
330330
# endif
331331

332+
# ifdef __cpp_lib_is_within_lifetime
333+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
334+
# endif
335+
332336
# ifndef __cpp_lib_logical_traits
333337
# error "__cpp_lib_logical_traits should be defined in c++17"
334338
# endif
@@ -376,10 +380,6 @@
376380
# error "__cpp_lib_void_t should have the value 201411L in c++17"
377381
# endif
378382

379-
# ifdef __cpp_lib_within_lifetime
380-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
381-
# endif
382-
383383
#elif TEST_STD_VER == 20
384384

385385
# ifndef __cpp_lib_bool_constant
@@ -489,6 +489,10 @@
489489
# error "__cpp_lib_is_swappable should have the value 201603L in c++20"
490490
# endif
491491

492+
# ifdef __cpp_lib_is_within_lifetime
493+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
494+
# endif
495+
492496
# ifndef __cpp_lib_logical_traits
493497
# error "__cpp_lib_logical_traits should be defined in c++20"
494498
# endif
@@ -542,10 +546,6 @@
542546
# error "__cpp_lib_void_t should have the value 201411L in c++20"
543547
# endif
544548

545-
# ifdef __cpp_lib_within_lifetime
546-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
547-
# endif
548-
549549
#elif TEST_STD_VER == 23
550550

551551
# ifndef __cpp_lib_bool_constant
@@ -658,6 +658,10 @@
658658
# error "__cpp_lib_is_swappable should have the value 201603L in c++23"
659659
# endif
660660

661+
# ifdef __cpp_lib_is_within_lifetime
662+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
663+
# endif
664+
661665
# ifndef __cpp_lib_logical_traits
662666
# error "__cpp_lib_logical_traits should be defined in c++23"
663667
# endif
@@ -720,10 +724,6 @@
720724
# error "__cpp_lib_void_t should have the value 201411L in c++23"
721725
# endif
722726

723-
# ifdef __cpp_lib_within_lifetime
724-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
725-
# endif
726-
727727
#elif TEST_STD_VER > 23
728728

729729
# ifndef __cpp_lib_bool_constant
@@ -836,6 +836,19 @@
836836
# error "__cpp_lib_is_swappable should have the value 201603L in c++26"
837837
# endif
838838

839+
# if !defined(_LIBCPP_VERSION)
840+
# ifndef __cpp_lib_is_within_lifetime
841+
# error "__cpp_lib_is_within_lifetime should be defined in c++26"
842+
# endif
843+
# if __cpp_lib_is_within_lifetime != 202306L
844+
# error "__cpp_lib_is_within_lifetime should have the value 202306L in c++26"
845+
# endif
846+
# else // _LIBCPP_VERSION
847+
# ifdef __cpp_lib_is_within_lifetime
848+
# error "__cpp_lib_is_within_lifetime should not be defined because it is unimplemented in libc++!"
849+
# endif
850+
# endif
851+
839852
# ifndef __cpp_lib_logical_traits
840853
# error "__cpp_lib_logical_traits should be defined in c++26"
841854
# endif
@@ -898,18 +911,5 @@
898911
# error "__cpp_lib_void_t should have the value 201411L in c++26"
899912
# endif
900913

901-
# if !defined(_LIBCPP_VERSION)
902-
# ifndef __cpp_lib_within_lifetime
903-
# error "__cpp_lib_within_lifetime should be defined in c++26"
904-
# endif
905-
# if __cpp_lib_within_lifetime != 202306L
906-
# error "__cpp_lib_within_lifetime should have the value 202306L in c++26"
907-
# endif
908-
# else // _LIBCPP_VERSION
909-
# ifdef __cpp_lib_within_lifetime
910-
# error "__cpp_lib_within_lifetime should not be defined because it is unimplemented in libc++!"
911-
# endif
912-
# endif
913-
914914
#endif // TEST_STD_VER > 23
915915

libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
__cpp_lib_is_pointer_interconvertible 201907L [C++20]
131131
__cpp_lib_is_scoped_enum 202011L [C++23]
132132
__cpp_lib_is_swappable 201603L [C++17]
133+
__cpp_lib_is_within_lifetime 202306L [C++26]
133134
__cpp_lib_jthread 201911L [C++20]
134135
__cpp_lib_latch 201907L [C++20]
135136
__cpp_lib_launder 201606L [C++17]
@@ -232,7 +233,6 @@
232233
__cpp_lib_unwrap_ref 201811L [C++20]
233234
__cpp_lib_variant 202102L [C++17]
234235
__cpp_lib_void_t 201411L [C++17]
235-
__cpp_lib_within_lifetime 202306L [C++26]
236236
*/
237237

238238
#include <version>
@@ -680,6 +680,10 @@
680680
# error "__cpp_lib_is_swappable should not be defined before c++17"
681681
# endif
682682

683+
# ifdef __cpp_lib_is_within_lifetime
684+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
685+
# endif
686+
683687
# ifdef __cpp_lib_jthread
684688
# error "__cpp_lib_jthread should not be defined before c++20"
685689
# endif
@@ -1060,10 +1064,6 @@
10601064
# error "__cpp_lib_void_t should not be defined before c++17"
10611065
# endif
10621066

1063-
# ifdef __cpp_lib_within_lifetime
1064-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
1065-
# endif
1066-
10671067
#elif TEST_STD_VER == 14
10681068

10691069
# ifdef __cpp_lib_adaptor_iterator_pair_constructor
@@ -1530,6 +1530,10 @@
15301530
# error "__cpp_lib_is_swappable should not be defined before c++17"
15311531
# endif
15321532

1533+
# ifdef __cpp_lib_is_within_lifetime
1534+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
1535+
# endif
1536+
15331537
# ifdef __cpp_lib_jthread
15341538
# error "__cpp_lib_jthread should not be defined before c++20"
15351539
# endif
@@ -1958,10 +1962,6 @@
19581962
# error "__cpp_lib_void_t should not be defined before c++17"
19591963
# endif
19601964

1961-
# ifdef __cpp_lib_within_lifetime
1962-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
1963-
# endif
1964-
19651965
#elif TEST_STD_VER == 17
19661966

19671967
# ifdef __cpp_lib_adaptor_iterator_pair_constructor
@@ -2518,6 +2518,10 @@
25182518
# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
25192519
# endif
25202520

2521+
# ifdef __cpp_lib_is_within_lifetime
2522+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
2523+
# endif
2524+
25212525
# ifdef __cpp_lib_jthread
25222526
# error "__cpp_lib_jthread should not be defined before c++20"
25232527
# endif
@@ -3054,10 +3058,6 @@
30543058
# error "__cpp_lib_void_t should have the value 201411L in c++17"
30553059
# endif
30563060

3057-
# ifdef __cpp_lib_within_lifetime
3058-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
3059-
# endif
3060-
30613061
#elif TEST_STD_VER == 20
30623062

30633063
# ifdef __cpp_lib_adaptor_iterator_pair_constructor
@@ -3797,6 +3797,10 @@
37973797
# error "__cpp_lib_is_swappable should have the value 201603L in c++20"
37983798
# endif
37993799

3800+
# ifdef __cpp_lib_is_within_lifetime
3801+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
3802+
# endif
3803+
38003804
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
38013805
# ifndef __cpp_lib_jthread
38023806
# error "__cpp_lib_jthread should be defined in c++20"
@@ -4438,10 +4442,6 @@
44384442
# error "__cpp_lib_void_t should have the value 201411L in c++20"
44394443
# endif
44404444

4441-
# ifdef __cpp_lib_within_lifetime
4442-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
4443-
# endif
4444-
44454445
#elif TEST_STD_VER == 23
44464446

44474447
# ifndef __cpp_lib_adaptor_iterator_pair_constructor
@@ -5259,6 +5259,10 @@
52595259
# error "__cpp_lib_is_swappable should have the value 201603L in c++23"
52605260
# endif
52615261

5262+
# ifdef __cpp_lib_is_within_lifetime
5263+
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
5264+
# endif
5265+
52625266
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
52635267
# ifndef __cpp_lib_jthread
52645268
# error "__cpp_lib_jthread should be defined in c++23"
@@ -6056,10 +6060,6 @@
60566060
# error "__cpp_lib_void_t should have the value 201411L in c++23"
60576061
# endif
60586062

6059-
# ifdef __cpp_lib_within_lifetime
6060-
# error "__cpp_lib_within_lifetime should not be defined before c++26"
6061-
# endif
6062-
60636063
#elif TEST_STD_VER > 23
60646064

60656065
# ifndef __cpp_lib_adaptor_iterator_pair_constructor
@@ -7042,6 +7042,19 @@
70427042
# error "__cpp_lib_is_swappable should have the value 201603L in c++26"
70437043
# endif
70447044

7045+
# if !defined(_LIBCPP_VERSION)
7046+
# ifndef __cpp_lib_is_within_lifetime
7047+
# error "__cpp_lib_is_within_lifetime should be defined in c++26"
7048+
# endif
7049+
# if __cpp_lib_is_within_lifetime != 202306L
7050+
# error "__cpp_lib_is_within_lifetime should have the value 202306L in c++26"
7051+
# endif
7052+
# else // _LIBCPP_VERSION
7053+
# ifdef __cpp_lib_is_within_lifetime
7054+
# error "__cpp_lib_is_within_lifetime should not be defined because it is unimplemented in libc++!"
7055+
# endif
7056+
# endif
7057+
70457058
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
70467059
# ifndef __cpp_lib_jthread
70477060
# error "__cpp_lib_jthread should be defined in c++26"
@@ -7911,18 +7924,5 @@
79117924
# error "__cpp_lib_void_t should have the value 201411L in c++26"
79127925
# endif
79137926

7914-
# if !defined(_LIBCPP_VERSION)
7915-
# ifndef __cpp_lib_within_lifetime
7916-
# error "__cpp_lib_within_lifetime should be defined in c++26"
7917-
# endif
7918-
# if __cpp_lib_within_lifetime != 202306L
7919-
# error "__cpp_lib_within_lifetime should have the value 202306L in c++26"
7920-
# endif
7921-
# else // _LIBCPP_VERSION
7922-
# ifdef __cpp_lib_within_lifetime
7923-
# error "__cpp_lib_within_lifetime should not be defined because it is unimplemented in libc++!"
7924-
# endif
7925-
# endif
7926-
79277927
#endif // TEST_STD_VER > 23
79287928

0 commit comments

Comments
 (0)