[flang][runtime] Make defined formatted I/O process format elementally (#74150)
[llvm-project.git] / libcxx / test / support / deduction_guides_sfinae_checks.h
blob8b715da5a34e25f95414256dad021f53621adda3
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef TEST_SUPPORT_DEDUCTION_GUIDES_SFINAE_CHECKS_H
10 #define TEST_SUPPORT_DEDUCTION_GUIDES_SFINAE_CHECKS_H
12 #include <cstddef>
13 #include <functional>
14 #include <initializer_list>
15 #include <iterator>
16 #include <memory>
17 #include <type_traits>
18 #include <utility>
20 #include "test_macros.h"
21 #if TEST_STD_VER >= 23
22 #include "almost_satisfies_types.h"
23 #endif
25 #if TEST_STD_VER >= 23
27 template <class T>
28 struct RangeT {
29 T* begin();
30 T* end();
32 static_assert(std::ranges::input_range<RangeT<int>>);
34 template <class T>
35 using BadRangeT = InputRangeNotDerivedFromGeneric<T>;
36 static_assert(std::ranges::range<BadRangeT<int>>);
37 static_assert(!std::ranges::input_range<BadRangeT<int>>);
39 #endif
41 // `SFINAEs_away` template variable checks whether the template arguments for
42 // a given template class `Instantiated` can be deduced from the given
43 // constructor parameter types `CtrArgs` using CTAD.
45 template<template<typename ...> class Instantiated, class ...CtrArgs,
46 class = decltype(Instantiated(std::declval<CtrArgs>()...))>
47 std::false_type SFINAEs_away_impl(int);
49 template<template<typename ...> class Instantiated, class ...CtrArgs>
50 std::true_type SFINAEs_away_impl(...);
52 template<template<typename ...> class Instantiated, class ...CtrArgs>
53 constexpr bool SFINAEs_away =
54 decltype(SFINAEs_away_impl<Instantiated, CtrArgs...>(0))::value;
56 struct Empty {};
58 // For sequence containers the deduction guides should be SFINAE'd away when
59 // given:
60 // - "bad" input iterators (that is, a type not qualifying as an input
61 // iterator);
62 // - a bad allocator;
63 // - a range not satisfying the `input_range` concept.
64 template<template<typename ...> class Container, typename InstantiatedContainer, typename BadAlloc = Empty>
65 constexpr void SequenceContainerDeductionGuidesSfinaeAway() {
66 using T = typename InstantiatedContainer::value_type;
67 using Alloc = std::allocator<T>;
68 using Iter = T*;
70 // Note: the only requirement in the Standard is that integral types cannot be
71 // considered input iterators; however, this doesn't work for sequence
72 // containers because they have constructors of the form `(size_type count,
73 // const value_type& value)`. These constructors would be used when passing
74 // two integral types and would deduce `value_type` to be an integral type.
75 #ifdef _LIBCPP_VERSION
76 using OutputIter = std::insert_iterator<InstantiatedContainer>;
77 #endif // _LIBCPP_VERSION
79 // (iter, iter)
81 // Cannot deduce from (BAD_iter, BAD_iter)
82 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter>);
84 // (iter, iter, alloc)
86 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
87 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Alloc>);
88 // Cannot deduce from (iter, iter, BAD_alloc)
89 static_assert(SFINAEs_away<Container, Iter, Iter, BadAlloc>);
91 // (alloc)
93 // Cannot deduce from (alloc)
94 static_assert(SFINAEs_away<Container, Alloc>);
96 #if TEST_STD_VER >= 23
97 using BadRange = BadRangeT<T>;
99 // (from_range, range)
101 // Cannot deduce from (BAD_range)
102 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
104 // (from_range, range, alloc)
106 // Cannot deduce from (range, BAD_alloc)
107 static_assert(SFINAEs_away<Container, std::from_range_t, RangeT<int>, BadAlloc>);
108 #endif
111 // Deduction guides should be SFINAE'd away when given:
112 // - a "bad" allocator (that is, a type not qualifying as an allocator);
113 // - an allocator instead of a container;
114 // - an allocator and a container that uses a different allocator;
115 // - a range not satisfying the `input_range` concept.
116 template<template<typename ...> class Container, typename InstantiatedContainer>
117 constexpr void ContainerAdaptorDeductionGuidesSfinaeAway() {
118 using T = typename InstantiatedContainer::value_type;
119 using Alloc [[maybe_unused]] = std::allocator<T>;
120 using Iter = T*;
122 using BadIter [[maybe_unused]] = int;
123 using BadAlloc = Empty;
125 // (container) -- no constraints.
127 // (container, alloc)
129 // Cannot deduce from (container, BAD_alloc)
130 static_assert(SFINAEs_away<Container, std::vector<T>, BadAlloc>);
132 // (iter, iter)
134 // Cannot deduce from (BAD_iter, BAD_iter)
135 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, BadIter, BadIter>);
137 #if TEST_STD_VER >= 23
138 using BadRange = BadRangeT<T>;
140 // (iter, iter, alloc)
142 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
143 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, BadIter, BadIter, Alloc>);
144 // Cannot deduce from (iter, iter, BAD_alloc)
145 static_assert(SFINAEs_away<Container, Iter, Iter, BadAlloc>);
147 // (from_range, range)
149 // Cannot deduce from (BAD_range)
150 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
152 // (from_range, range, alloc)
154 // Cannot deduce from (range, BAD_alloc)
155 static_assert(SFINAEs_away<Container, std::from_range_t, RangeT<int>, BadAlloc>);
156 #endif
159 // For associative containers the deduction guides should be SFINAE'd away when
160 // given:
161 // - "bad" input iterators (that is, a type not qualifying as an input
162 // iterator);
163 // - a bad allocator;
164 // - an allocator in place of a comparator;
165 // - a range not satisfying the `input_range` concept.
166 template<template<typename ...> class Container, typename InstantiatedContainer>
167 constexpr void AssociativeContainerDeductionGuidesSfinaeAway() {
168 using ValueType = typename InstantiatedContainer::value_type;
169 using Comp = std::less<int>;
170 using Alloc = std::allocator<ValueType>;
171 using Iter = ValueType*;
172 using InitList = std::initializer_list<ValueType>;
174 struct BadAlloc {};
175 // The only requirement in the Standard is that integral types cannot be
176 // considered input iterators, beyond that it is unspecified.
177 using BadIter = int;
178 #ifdef _LIBCPP_VERSION
179 using OutputIter = std::insert_iterator<InstantiatedContainer>;
180 #endif // _LIBCPP_VERSION
181 using AllocAsComp = Alloc;
183 // (iter, iter)
185 // Cannot deduce from (BAD_iter, BAD_iter)
186 static_assert(SFINAEs_away<Container, BadIter, BadIter>);
187 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter>);
189 // (iter, iter, comp)
191 // Cannot deduce from (BAD_iter, BAD_iter, comp)
192 static_assert(SFINAEs_away<Container, BadIter, BadIter, Comp>);
193 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Comp>);
195 // (iter, iter, comp, alloc)
197 // Cannot deduce from (BAD_iter, BAD_iter, comp, alloc)
198 static_assert(SFINAEs_away<Container, BadIter, BadIter, Comp, Alloc>);
199 LIBCPP_STATIC_ASSERT(
200 SFINAEs_away<Container, OutputIter, OutputIter, Comp, Alloc>);
201 // Cannot deduce from (iter, iter, ALLOC_as_comp, alloc)
202 static_assert(SFINAEs_away<Container, Iter, Iter, AllocAsComp, Alloc>);
203 // Cannot deduce from (iter, iter, comp, BAD_alloc)
204 static_assert(SFINAEs_away<Container, Iter, Iter, Comp, BadAlloc>);
206 // (iter, iter, alloc)
208 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
209 static_assert(SFINAEs_away<Container, BadIter, BadIter, Alloc>);
210 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Alloc>);
211 // Note: (iter, iter, BAD_alloc) is interpreted as (iter, iter, comp)
212 // instead and fails upon instantiation. There is no requirement to SFINAE
213 // away bad comparators.
215 // (init_list, comp, alloc)
217 // Cannot deduce from (init_list, ALLOC_as_comp, alloc)
218 static_assert(SFINAEs_away<Container, InitList, AllocAsComp, Alloc>);
219 // Cannot deduce from (init_list, comp, BAD_alloc)
220 static_assert(SFINAEs_away<Container, InitList, Comp, BadAlloc>);
222 // (init_list, alloc)
224 // Note: (init_list, BAD_alloc) is interpreted as (init_list, comp) instead
225 // and fails upon instantiation. There is no requirement to SFINAE away bad
226 // comparators.
228 #if TEST_STD_VER >= 23
229 using Range = RangeT<ValueType>;
230 using BadRange = BadRangeT<ValueType>;
232 // (from_range, range)
234 // Can deduce from (from_range, range)
235 static_assert(!SFINAEs_away<Container, std::from_range_t, Range>);
236 // Cannot deduce from (from_range, BAD_range)
237 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
239 // (from_range, range, comp)
241 // Can deduce from (from_range, _range, comp)
242 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Comp>);
243 // Cannot deduce from (from_range, BAD_range, comp)
244 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Comp>);
246 // (from_range, range, comp, alloc)
248 // Can deduce from (from_range, range, comp, alloc)
249 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Comp, Alloc>);
250 // Cannot deduce from (from_range, BAD_range, comp, alloc)
251 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Comp, Alloc>);
252 // Cannot deduce from (from_range, range, comp, BAD_alloc)
253 static_assert(SFINAEs_away<Container, std::from_range_t, Range, Comp, BadAlloc>);
255 // (from_range, range, alloc)
257 // Can deduce from (from_range, range, alloc)
258 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Alloc>);
259 // Cannot deduce from (from_range, BAD_range, alloc)
260 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Alloc>);
261 // Note: (from_range, range, BAD_alloc) is interpreted as (from_range, range, comp) instead.
262 #endif
265 // For unordered containers the deduction guides should be SFINAE'd away when
266 // given:
267 // - "bad" input iterators (that is, a type not qualifying as an input
268 // iterator);
269 // - a bad allocator;
270 // - a bad hash functor (an integral type in place of a hash);
271 // - an allocator in place of a hash functor;
272 // - an allocator in place of a predicate;
273 // - a range not satisfying the `input_range` concept.
274 template<template<typename ...> class Container, typename InstantiatedContainer>
275 constexpr void UnorderedContainerDeductionGuidesSfinaeAway() {
276 using ValueType = typename InstantiatedContainer::value_type;
277 using Pred = std::equal_to<int>;
278 using Hash = std::hash<int>;
279 using Alloc = std::allocator<ValueType>;
280 using Iter = ValueType*;
281 using InitList = std::initializer_list<ValueType>;
283 using BadHash = short;
284 struct BadAlloc {};
285 // The only requirement in the Standard is that integral types cannot be
286 // considered input iterators, beyond that it is unspecified.
287 using BadIter = int;
288 #ifdef _LIBCPP_VERSION
289 using OutputIter = std::insert_iterator<InstantiatedContainer>;
290 #endif // _LIBCPP_VERSION
291 using AllocAsHash = Alloc;
292 using AllocAsPred = Alloc;
294 // (iter, iter)
296 // Cannot deduce from (BAD_iter, BAD_iter)
297 static_assert(SFINAEs_away<Container, BadIter, BadIter>);
298 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter>);
300 // (iter, iter, buckets)
302 // Cannot deduce from (BAD_iter, BAD_iter, buckets)
303 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t>);
304 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, std::size_t>);
306 // (iter, iter, buckets, hash)
308 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash)
309 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash>);
310 LIBCPP_STATIC_ASSERT(
311 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Hash>);
312 // Cannot deduce from (iter, iter, buckets, BAD_hash)
313 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash>);
314 // Note: (iter, iter, buckets, ALLOC_as_hash) is allowed -- it just calls
315 // (iter, iter, buckets, alloc)
317 // (iter, iter, buckets, hash, pred)
319 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash, pred)
320 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash, Pred>);
321 LIBCPP_STATIC_ASSERT(
322 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Hash, Pred>);
323 // Cannot deduce from (iter, iter, buckets, BAD_hash, pred)
324 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash, Pred>);
325 // Cannot deduce from (iter, iter, buckets, ALLOC_as_hash, pred)
326 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, AllocAsHash, Pred>);
327 // Note: (iter, iter, buckets, hash, ALLOC_as_pred) is allowed -- it just
328 // calls (iter, iter, buckets, hash, alloc)
330 // (iter, iter, buckets, hash, pred, alloc)
332 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash, pred, alloc)
333 static_assert(
334 SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash, Pred, Alloc>);
335 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter,
336 std::size_t, Hash, Pred, Alloc>);
337 // Cannot deduce from (iter, iter, buckets, BAD_hash, pred, alloc)
338 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash, Pred, Alloc>);
339 // Cannot deduce from (iter, iter, buckets, ALLOC_as_hash, pred, alloc)
340 static_assert(
341 SFINAEs_away<Container, Iter, Iter, std::size_t, AllocAsHash, Pred, Alloc>);
342 // Cannot deduce from (iter, iter, buckets, hash, ALLOC_as_pred, alloc)
343 static_assert(
344 SFINAEs_away<Container, Iter, Iter, std::size_t, Hash, AllocAsPred, Alloc>);
345 // Cannot deduce from (iter, iter, buckets, hash, pred, BAD_alloc)
346 static_assert(
347 SFINAEs_away<Container, Iter, Iter, std::size_t, Hash, Pred, BadAlloc>);
349 // (iter, iter, buckets, alloc)
351 // Cannot deduce from (BAD_iter, BAD_iter, buckets, alloc)
352 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Alloc>);
353 LIBCPP_STATIC_ASSERT(
354 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Alloc>);
355 // Note: (iter, iter, buckets, BAD_alloc) is interpreted as (iter, iter,
356 // buckets, hash), which is valid because the only requirement for the hash
357 // parameter is that it's not integral.
359 // (iter, iter, alloc)
361 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
362 static_assert(SFINAEs_away<Container, BadIter, BadIter, Alloc>);
363 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Alloc>);
364 // Cannot deduce from (iter, iter, BAD_alloc)
365 static_assert(SFINAEs_away<Container, Iter, Iter, BadAlloc>);
367 // (iter, iter, buckets, hash, alloc)
369 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash, alloc)
370 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash, Alloc>);
371 LIBCPP_STATIC_ASSERT(
372 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Hash, Alloc>);
373 // Cannot deduce from (iter, iter, buckets, BAD_hash, alloc)
374 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash, Alloc>);
375 // Cannot deduce from (iter, iter, buckets, ALLOC_as_hash, alloc)
376 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, AllocAsHash, Alloc>);
377 // Note: (iter, iter, buckets, hash, BAD_alloc) is interpreted as (iter, iter,
378 // buckets, hash, pred), which is valid because there are no requirements for
379 // the predicate.
381 // (init_list, buckets, hash)
383 // Cannot deduce from (init_list, buckets, BAD_hash)
384 static_assert(SFINAEs_away<Container, InitList, std::size_t, BadHash>);
385 // Note: (init_list, buckets, ALLOC_as_hash) is interpreted as (init_list,
386 // buckets, alloc), which is valid.
388 // (init_list, buckets, hash, pred)
390 // Cannot deduce from (init_list, buckets, BAD_hash, pred)
391 static_assert(SFINAEs_away<Container, InitList, std::size_t, BadHash, Pred>);
392 // Cannot deduce from (init_list, buckets, ALLOC_as_hash, pred)
393 static_assert(SFINAEs_away<Container, InitList, std::size_t, AllocAsHash, Pred>);
394 // Note: (init_list, buckets, hash, ALLOC_as_pred) is interpreted as
395 // (init_list, buckets, hash, alloc), which is valid.
397 // (init_list, buckets, hash, pred, alloc)
399 // Cannot deduce from (init_list, buckets, BAD_hash, pred, alloc)
400 static_assert(
401 SFINAEs_away<Container, InitList, std::size_t, BadHash, Pred, Alloc>);
402 // Cannot deduce from (init_list, buckets, ALLOC_as_hash, pred, alloc)
403 static_assert(
404 SFINAEs_away<Container, InitList, std::size_t, AllocAsHash, Pred, Alloc>);
405 // Cannot deduce from (init_list, buckets, hash, ALLOC_as_pred, alloc)
406 static_assert(
407 SFINAEs_away<Container, InitList, std::size_t, Hash, AllocAsPred, Alloc>);
408 // Cannot deduce from (init_list, buckets, hash, pred, BAD_alloc)
409 static_assert(
410 SFINAEs_away<Container, InitList, std::size_t, Hash, Pred, BadAlloc>);
412 // (init_list, buckets, alloc)
414 // Note: (init_list, buckets, BAD_alloc) is interpreted as (init_list,
415 // buckets, hash), which is valid because the only requirement for the hash
416 // parameter is that it's not integral.
418 // (init_list, buckets, hash, alloc)
420 // Cannot deduce from (init_list, buckets, BAD_hash, alloc)
421 static_assert(SFINAEs_away<Container, InitList, std::size_t, BadHash, Alloc>);
422 // Cannot deduce from (init_list, buckets, ALLOC_as_hash, alloc)
423 static_assert(SFINAEs_away<Container, InitList, std::size_t, AllocAsHash, Alloc>);
425 // (init_list, alloc)
427 // Cannot deduce from (init_list, BAD_alloc)
428 static_assert(SFINAEs_away<Container, InitList, BadAlloc>);
430 #if TEST_STD_VER >= 23
431 using Range = RangeT<ValueType>;
432 using BadRange = BadRangeT<ValueType>;
434 // (from_range, range)
436 // Can deduce from (from_range, range)
437 static_assert(!SFINAEs_away<Container, std::from_range_t, Range>);
438 // Cannot deduce from (from_range, BAD_range)
439 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
441 // (from_range, range, buckets)
443 // Can deduce from (from_range, range, buckets)
444 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t>);
445 // Cannot deduce from (from_range, BAD_range, buckets)
446 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t>);
448 // (from_range, range, buckets, hash)
450 // Can deduce from (from_range, range, buckets, hash)
451 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash>);
452 // Cannot deduce from (from_range, BAD_range, buckets, hash)
453 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash>);
454 // Cannot deduce from (from_range, range, buckets, BAD_hash)
455 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash>);
457 // (from_range, range, buckets, hash, pred)
459 // Can deduce from (from_range, range, buckets, hash, pred)
460 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Pred>);
461 // Cannot deduce from (from_range, BAD_range, buckets, hash, pred)
462 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash, Pred>);
463 // Cannot deduce from (from_range, range, buckets, BAD_hash, pred)
464 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash, Pred>);
466 // (from_range, range, buckets, hash, pred, alloc)
468 // Can deduce from (from_range, range, buckets, hash, pred, alloc)
469 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Pred, Alloc>);
470 // Cannot deduce from (from_range, BAD_range, buckets, hash, pred, alloc)
471 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash, Pred, Alloc>);
472 // Cannot deduce from (from_range, range, buckets, BAD_hash, pred, alloc)
473 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash, Pred, Alloc>);
474 // Cannot deduce from (from_range, range, buckets, hash, pred, BAD_alloc)
475 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Pred, BadAlloc>);
477 // (from_range, range, buckets, alloc)
479 // Can deduce from (from_range, range, buckets, alloc)
480 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Alloc>);
481 // Cannot deduce from (from_range, BAD_range, buckets, alloc)
482 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Alloc>);
483 // Note: (from_range, range, buckets, BAD_alloc) is interpreted as (from_range, range, buckets, hash), which is valid
484 // because the only requirement for the hash parameter is that it's not integral.
486 // (from_range, range, alloc)
488 // Can deduce from (from_range, range, alloc)
489 // TODO(LWG 2713): uncomment this test once the constructor is added.
490 // static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Alloc>);
491 // Cannot deduce from (from_range, BAD_range, alloc)
492 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Alloc>);
493 // Cannot deduce from (from_range, range, BAD_alloc)
494 static_assert(SFINAEs_away<Container, std::from_range_t, Range, BadAlloc>);
496 // (from_range, range, buckets, hash, alloc)
498 // Can deduce from (from_range, range, buckets, hash, alloc)
499 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Alloc>);
500 // Cannot deduce from (from_range, BAD_range, buckets, hash, alloc)
501 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash, Alloc>);
502 // Cannot deduce from (from_range, range, buckets, BAD_hash, alloc)
503 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash, Alloc>);
504 // Cannot deduce from (from_range, range, buckets, ALLOC_as_hash, alloc)
505 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, AllocAsHash, Alloc>);
506 // Cannot deduce from (from_range, range, buckets, hash, BAD_alloc)
507 // Note: (from_range, range, buckets, hash, BAD_alloc) is interpreted as (from_range, range, buckets, hash, pred),
508 // which is valid because the only requirement for the predicate parameter is that it does not resemble an allocator.
509 #endif
512 #endif // TEST_SUPPORT_DEDUCTION_GUIDES_SFINAE_CHECKS_H