File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
test/std/utilities/variant/variant.variant/variant.ctor Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -67,20 +67,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
67
67
68
68
#if __has_builtin(__builtin_invoke)
69
69
70
- template <class ... _Args>
71
- using __invoke_result_t _LIBCPP_NODEBUG = decltype (__builtin_invoke(std::declval<_Args>()...));
72
-
73
70
template <class , class ... _Args>
74
71
struct __invoke_result_impl {};
75
72
76
73
template <class ... _Args>
77
- struct __invoke_result_impl <__void_t <__invoke_result_t <_Args...> >, _Args...> {
78
- using type _LIBCPP_NODEBUG = __invoke_result_t <_Args...> ;
74
+ struct __invoke_result_impl <__void_t <decltype (__builtin_invoke(std::declval <_Args>() ...)) >, _Args...> {
75
+ using type _LIBCPP_NODEBUG = decltype (__builtin_invoke(std::declval <_Args>() ...)) ;
79
76
};
80
77
81
78
template <class ... _Args>
82
79
using __invoke_result _LIBCPP_NODEBUG = __invoke_result_impl<void , _Args...>;
83
80
81
+ template <class ... _Args>
82
+ using __invoke_result_t _LIBCPP_NODEBUG = typename __invoke_result<_Args...>::type;
83
+
84
84
template <class ... _Args>
85
85
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __invoke_result_t <_Args...> __invoke (_Args&&... __args)
86
86
_NOEXCEPT_(noexcept (__builtin_invoke(std::forward<_Args>(__args)...))) {
Original file line number Diff line number Diff line change @@ -173,12 +173,28 @@ void test_vector_bool() {
173
173
assert (std::get<0 >(v) == true );
174
174
}
175
175
176
+ struct ConvertibleFromAny {
177
+ template <class V >
178
+ ConvertibleFromAny (V) {}
179
+ };
180
+
176
181
int main (int , char **) {
177
182
test_T_ctor_basic ();
178
183
test_T_ctor_noexcept ();
179
184
test_T_ctor_sfinae ();
180
185
test_no_narrowing_check_for_class_types ();
181
186
test_construction_with_repeated_types ();
182
187
test_vector_bool ();
188
+
189
+ { // Check that the constraints are evaluated lazily (see https://github.com/llvm/llvm-project/issues/151328)
190
+ struct Matcher {
191
+ Matcher () {}
192
+ Matcher (std::variant<ConvertibleFromAny>) {}
193
+ };
194
+
195
+ Matcher vec;
196
+ [[maybe_unused]] Matcher m = std::move (vec);
197
+ }
198
+
183
199
return 0 ;
184
200
}
You can’t perform that action at this time.
0 commit comments