Skip to content

Commit 8af4623

Browse files
Remove inactive code branches
1 parent 4369c4a commit 8af4623

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

libcxx/include/__type_traits/reference_constructs_from_temporary.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,10 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool reference_constructs_from_tempo
3333
#if __has_builtin(__reference_constructs_from_temporary)
3434
template <class _Tp, class _Up>
3535
inline const bool __reference_constructs_from_temporary_v = __reference_constructs_from_temporary(_Tp, _Up);
36-
#elif __has_builtin(__reference_binds_to_temporary)
37-
// TODO: Remove this once all support compilers have __reference_constructs_from_temporary implemented.
38-
template <class _Tp, class _Up>
39-
inline const bool __reference_constructs_from_temporary_v = __reference_binds_to_temporary(_Tp, _Up);
4036
#else
41-
// TODO: Remove this once https://github.com/llvm/llvm-project/issues/111477 no longer affects supported compilers.
37+
// TODO(LLVM 22): Remove this as all support compilers should have __reference_constructs_from_temporary implemented.
4238
template <class _Tp, class _Up>
43-
inline const bool __reference_constructs_from_temporary_v = false;
39+
inline const bool __reference_constructs_from_temporary_v = __reference_binds_to_temporary(_Tp, _Up);
4440
#endif
4541

4642
_LIBCPP_END_NAMESPACE_STD

libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.verify.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,7 @@ template <class T> struct CannotDeduce {
3838
template <class ...Args>
3939
void F(typename CannotDeduce<std::tuple<Args...>>::type const&) {}
4040

41-
#if TEST_HAS_BUILTIN(__reference_constructs_from_temporary)
42-
# define TEST_HAS_REFERENCE_BINDING_TRAIT 1
43-
#elif TEST_HAS_BUILTIN(__reference_binds_to_temporary)
44-
# define TEST_HAS_REFERENCE_BINDING_TRAIT 1
45-
#else
46-
# define TEST_HAS_REFERENCE_BINDING_TRAIT 0
47-
#endif
48-
4941
void f() {
50-
#if TEST_HAS_REFERENCE_BINDING_TRAIT
5142
// Test that we emit our diagnostic from the library.
5243
// expected-error@tuple:* 8 {{Attempted construction of reference element binds to a temporary whose lifetime has ended}}
5344

@@ -80,8 +71,4 @@ void f() {
8071
std::tuple<std::string &&> t2("hello"); // expected-note {{requested here}}
8172
std::tuple<std::string &&> t3(std::allocator_arg, alloc, "hello"); // expected-note {{requested here}}
8273
}
83-
#else
84-
#error force failure
85-
// expected-error@-1 {{force failure}}
86-
#endif
8774
}

libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
# define ASSERT_REFERENCE_BINDS_TEMPORARY(...) static_assert(__reference_constructs_from_temporary(__VA_ARGS__), "")
2323
# define ASSERT_NOT_REFERENCE_BINDS_TEMPORARY(...) \
2424
static_assert(!__reference_constructs_from_temporary(__VA_ARGS__), "")
25-
#elif TEST_HAS_BUILTIN(__reference_binds_to_temporary)
25+
#else
26+
// TODO(LLVM 22): Remove this as all support compilers should have __reference_constructs_from_temporary implemented.
2627
# define ASSERT_REFERENCE_BINDS_TEMPORARY(...) static_assert(__reference_binds_to_temporary(__VA_ARGS__), "")
2728
# define ASSERT_NOT_REFERENCE_BINDS_TEMPORARY(...) static_assert(!__reference_binds_to_temporary(__VA_ARGS__), "")
28-
#else
29-
# define ASSERT_REFERENCE_BINDS_TEMPORARY(...) static_assert(true, "")
30-
# define ASSERT_NOT_REFERENCE_BINDS_TEMPORARY(...) static_assert(true, "")
3129
#endif
3230

3331
template <class Tp>

0 commit comments

Comments
 (0)