[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / libcxx / test / support / deduction_guides_sfinae_checks.h
blob0c32b3732413a9fef3f3075c6a15357c919a5a4d
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>
19 #include <vector>
21 #include "test_macros.h"
22 #if TEST_STD_VER >= 23
23 #include "almost_satisfies_types.h"
24 #endif
26 #if TEST_STD_VER >= 23
28 template <class T>
29 struct RangeT {
30 T* begin();
31 T* end();
33 static_assert(std::ranges::input_range<RangeT<int>>);
35 template <class T>
36 using BadRangeT = InputRangeNotDerivedFromGeneric<T>;
37 static_assert(std::ranges::range<BadRangeT<int>>);
38 static_assert(!std::ranges::input_range<BadRangeT<int>>);
40 #endif
42 // `SFINAEs_away` template variable checks whether the template arguments for
43 // a given template class `Instantiated` can be deduced from the given
44 // constructor parameter types `CtrArgs` using CTAD.
46 template<template<typename ...> class Instantiated, class ...CtrArgs,
47 class = decltype(Instantiated(std::declval<CtrArgs>()...))>
48 std::false_type SFINAEs_away_impl(int);
50 template<template<typename ...> class Instantiated, class ...CtrArgs>
51 std::true_type SFINAEs_away_impl(...);
53 template<template<typename ...> class Instantiated, class ...CtrArgs>
54 constexpr bool SFINAEs_away =
55 decltype(SFINAEs_away_impl<Instantiated, CtrArgs...>(0))::value;
57 struct Empty {};
59 // For sequence containers the deduction guides should be SFINAE'd away when
60 // given:
61 // - "bad" input iterators (that is, a type not qualifying as an input
62 // iterator);
63 // - a bad allocator;
64 // - a range not satisfying the `input_range` concept.
65 template<template<typename ...> class Container, typename InstantiatedContainer, typename BadAlloc = Empty>
66 constexpr void SequenceContainerDeductionGuidesSfinaeAway() {
67 using T = typename InstantiatedContainer::value_type;
68 using Alloc = std::allocator<T>;
69 using Iter = T*;
71 // Note: the only requirement in the Standard is that integral types cannot be
72 // considered input iterators; however, this doesn't work for sequence
73 // containers because they have constructors of the form `(size_type count,
74 // const value_type& value)`. These constructors would be used when passing
75 // two integral types and would deduce `value_type` to be an integral type.
76 #ifdef _LIBCPP_VERSION
77 using OutputIter = std::insert_iterator<InstantiatedContainer>;
78 #endif // _LIBCPP_VERSION
80 // (iter, iter)
82 // Cannot deduce from (BAD_iter, BAD_iter)
83 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter>);
85 // (iter, iter, alloc)
87 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
88 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Alloc>);
89 // Cannot deduce from (iter, iter, BAD_alloc)
90 static_assert(SFINAEs_away<Container, Iter, Iter, BadAlloc>);
92 // (alloc)
94 // Cannot deduce from (alloc)
95 static_assert(SFINAEs_away<Container, Alloc>);
97 #if TEST_STD_VER >= 23
98 using BadRange = BadRangeT<T>;
100 // (from_range, range)
102 // Cannot deduce from (BAD_range)
103 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
105 // (from_range, range, alloc)
107 // Cannot deduce from (range, BAD_alloc)
108 static_assert(SFINAEs_away<Container, std::from_range_t, RangeT<int>, BadAlloc>);
109 #endif
112 // Deduction guides should be SFINAE'd away when given:
113 // - a "bad" allocator (that is, a type not qualifying as an allocator);
114 // - an allocator instead of a container;
115 // - an allocator and a container that uses a different allocator;
116 // - a range not satisfying the `input_range` concept.
117 template<template<typename ...> class Container, typename InstantiatedContainer>
118 constexpr void ContainerAdaptorDeductionGuidesSfinaeAway() {
119 using T = typename InstantiatedContainer::value_type;
120 using Alloc [[maybe_unused]] = std::allocator<T>;
121 using Iter = T*;
123 using BadIter [[maybe_unused]] = int;
124 using BadAlloc = Empty;
126 // (container) -- no constraints.
128 // (container, alloc)
130 // Cannot deduce from (container, BAD_alloc)
131 static_assert(SFINAEs_away<Container, std::vector<T>, BadAlloc>);
133 // (iter, iter)
135 // Cannot deduce from (BAD_iter, BAD_iter)
136 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, BadIter, BadIter>);
138 #if TEST_STD_VER >= 23
139 using BadRange = BadRangeT<T>;
141 // (iter, iter, alloc)
143 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
144 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, BadIter, BadIter, Alloc>);
145 // Cannot deduce from (iter, iter, BAD_alloc)
146 static_assert(SFINAEs_away<Container, Iter, Iter, BadAlloc>);
148 // (from_range, range)
150 // Cannot deduce from (BAD_range)
151 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
153 // (from_range, range, alloc)
155 // Cannot deduce from (range, BAD_alloc)
156 static_assert(SFINAEs_away<Container, std::from_range_t, RangeT<int>, BadAlloc>);
157 #endif
160 // For associative containers the deduction guides should be SFINAE'd away when
161 // given:
162 // - "bad" input iterators (that is, a type not qualifying as an input
163 // iterator);
164 // - a bad allocator;
165 // - an allocator in place of a comparator;
166 // - a range not satisfying the `input_range` concept.
167 template<template<typename ...> class Container, typename InstantiatedContainer>
168 constexpr void AssociativeContainerDeductionGuidesSfinaeAway() {
169 using ValueType = typename InstantiatedContainer::value_type;
170 using Comp = std::less<int>;
171 using Alloc = std::allocator<ValueType>;
172 using Iter = ValueType*;
173 using InitList = std::initializer_list<ValueType>;
175 struct BadAlloc {};
176 // The only requirement in the Standard is that integral types cannot be
177 // considered input iterators, beyond that it is unspecified.
178 using BadIter = int;
179 #ifdef _LIBCPP_VERSION
180 using OutputIter = std::insert_iterator<InstantiatedContainer>;
181 #endif // _LIBCPP_VERSION
182 using AllocAsComp = Alloc;
184 // (iter, iter)
186 // Cannot deduce from (BAD_iter, BAD_iter)
187 static_assert(SFINAEs_away<Container, BadIter, BadIter>);
188 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter>);
190 // (iter, iter, comp)
192 // Cannot deduce from (BAD_iter, BAD_iter, comp)
193 static_assert(SFINAEs_away<Container, BadIter, BadIter, Comp>);
194 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Comp>);
196 // (iter, iter, comp, alloc)
198 // Cannot deduce from (BAD_iter, BAD_iter, comp, alloc)
199 static_assert(SFINAEs_away<Container, BadIter, BadIter, Comp, Alloc>);
200 LIBCPP_STATIC_ASSERT(
201 SFINAEs_away<Container, OutputIter, OutputIter, Comp, Alloc>);
202 // Cannot deduce from (iter, iter, ALLOC_as_comp, alloc)
203 static_assert(SFINAEs_away<Container, Iter, Iter, AllocAsComp, Alloc>);
204 // Cannot deduce from (iter, iter, comp, BAD_alloc)
205 static_assert(SFINAEs_away<Container, Iter, Iter, Comp, BadAlloc>);
207 // (iter, iter, alloc)
209 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
210 static_assert(SFINAEs_away<Container, BadIter, BadIter, Alloc>);
211 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Alloc>);
212 // Note: (iter, iter, BAD_alloc) is interpreted as (iter, iter, comp)
213 // instead and fails upon instantiation. There is no requirement to SFINAE
214 // away bad comparators.
216 // (init_list, comp, alloc)
218 // Cannot deduce from (init_list, ALLOC_as_comp, alloc)
219 static_assert(SFINAEs_away<Container, InitList, AllocAsComp, Alloc>);
220 // Cannot deduce from (init_list, comp, BAD_alloc)
221 static_assert(SFINAEs_away<Container, InitList, Comp, BadAlloc>);
223 // (init_list, alloc)
225 // Note: (init_list, BAD_alloc) is interpreted as (init_list, comp) instead
226 // and fails upon instantiation. There is no requirement to SFINAE away bad
227 // comparators.
229 #if TEST_STD_VER >= 23
230 using Range = RangeT<ValueType>;
231 using BadRange = BadRangeT<ValueType>;
233 // (from_range, range)
235 // Can deduce from (from_range, range)
236 static_assert(!SFINAEs_away<Container, std::from_range_t, Range>);
237 // Cannot deduce from (from_range, BAD_range)
238 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
240 // (from_range, range, comp)
242 // Can deduce from (from_range, _range, comp)
243 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Comp>);
244 // Cannot deduce from (from_range, BAD_range, comp)
245 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Comp>);
247 // (from_range, range, comp, alloc)
249 // Can deduce from (from_range, range, comp, alloc)
250 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Comp, Alloc>);
251 // Cannot deduce from (from_range, BAD_range, comp, alloc)
252 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Comp, Alloc>);
253 // Cannot deduce from (from_range, range, comp, BAD_alloc)
254 static_assert(SFINAEs_away<Container, std::from_range_t, Range, Comp, BadAlloc>);
256 // (from_range, range, alloc)
258 // Can deduce from (from_range, range, alloc)
259 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Alloc>);
260 // Cannot deduce from (from_range, BAD_range, alloc)
261 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Alloc>);
262 // Note: (from_range, range, BAD_alloc) is interpreted as (from_range, range, comp) instead.
263 #endif
266 // For unordered containers the deduction guides should be SFINAE'd away when
267 // given:
268 // - "bad" input iterators (that is, a type not qualifying as an input
269 // iterator);
270 // - a bad allocator;
271 // - a bad hash functor (an integral type in place of a hash);
272 // - an allocator in place of a hash functor;
273 // - an allocator in place of a predicate;
274 // - a range not satisfying the `input_range` concept.
275 template<template<typename ...> class Container, typename InstantiatedContainer>
276 constexpr void UnorderedContainerDeductionGuidesSfinaeAway() {
277 using ValueType = typename InstantiatedContainer::value_type;
278 using Pred = std::equal_to<int>;
279 using Hash = std::hash<int>;
280 using Alloc = std::allocator<ValueType>;
281 using Iter = ValueType*;
282 using InitList = std::initializer_list<ValueType>;
284 using BadHash = short;
285 struct BadAlloc {};
286 // The only requirement in the Standard is that integral types cannot be
287 // considered input iterators, beyond that it is unspecified.
288 using BadIter = int;
289 #ifdef _LIBCPP_VERSION
290 using OutputIter = std::insert_iterator<InstantiatedContainer>;
291 #endif // _LIBCPP_VERSION
292 using AllocAsHash = Alloc;
293 using AllocAsPred = Alloc;
295 // (iter, iter)
297 // Cannot deduce from (BAD_iter, BAD_iter)
298 static_assert(SFINAEs_away<Container, BadIter, BadIter>);
299 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter>);
301 // (iter, iter, buckets)
303 // Cannot deduce from (BAD_iter, BAD_iter, buckets)
304 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t>);
305 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, std::size_t>);
307 // (iter, iter, buckets, hash)
309 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash)
310 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash>);
311 LIBCPP_STATIC_ASSERT(
312 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Hash>);
313 // Cannot deduce from (iter, iter, buckets, BAD_hash)
314 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash>);
315 // Note: (iter, iter, buckets, ALLOC_as_hash) is allowed -- it just calls
316 // (iter, iter, buckets, alloc)
318 // (iter, iter, buckets, hash, pred)
320 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash, pred)
321 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash, Pred>);
322 LIBCPP_STATIC_ASSERT(
323 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Hash, Pred>);
324 // Cannot deduce from (iter, iter, buckets, BAD_hash, pred)
325 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash, Pred>);
326 // Cannot deduce from (iter, iter, buckets, ALLOC_as_hash, pred)
327 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, AllocAsHash, Pred>);
328 // Note: (iter, iter, buckets, hash, ALLOC_as_pred) is allowed -- it just
329 // calls (iter, iter, buckets, hash, alloc)
331 // (iter, iter, buckets, hash, pred, alloc)
333 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash, pred, alloc)
334 static_assert(
335 SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash, Pred, Alloc>);
336 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter,
337 std::size_t, Hash, Pred, Alloc>);
338 // Cannot deduce from (iter, iter, buckets, BAD_hash, pred, alloc)
339 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash, Pred, Alloc>);
340 // Cannot deduce from (iter, iter, buckets, ALLOC_as_hash, pred, alloc)
341 static_assert(
342 SFINAEs_away<Container, Iter, Iter, std::size_t, AllocAsHash, Pred, Alloc>);
343 // Cannot deduce from (iter, iter, buckets, hash, ALLOC_as_pred, alloc)
344 static_assert(
345 SFINAEs_away<Container, Iter, Iter, std::size_t, Hash, AllocAsPred, Alloc>);
346 // Cannot deduce from (iter, iter, buckets, hash, pred, BAD_alloc)
347 static_assert(
348 SFINAEs_away<Container, Iter, Iter, std::size_t, Hash, Pred, BadAlloc>);
350 // (iter, iter, buckets, alloc)
352 // Cannot deduce from (BAD_iter, BAD_iter, buckets, alloc)
353 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Alloc>);
354 LIBCPP_STATIC_ASSERT(
355 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Alloc>);
356 // Note: (iter, iter, buckets, BAD_alloc) is interpreted as (iter, iter,
357 // buckets, hash), which is valid because the only requirement for the hash
358 // parameter is that it's not integral.
360 // (iter, iter, alloc)
362 // Cannot deduce from (BAD_iter, BAD_iter, alloc)
363 static_assert(SFINAEs_away<Container, BadIter, BadIter, Alloc>);
364 LIBCPP_STATIC_ASSERT(SFINAEs_away<Container, OutputIter, OutputIter, Alloc>);
365 // Cannot deduce from (iter, iter, BAD_alloc)
366 static_assert(SFINAEs_away<Container, Iter, Iter, BadAlloc>);
368 // (iter, iter, buckets, hash, alloc)
370 // Cannot deduce from (BAD_iter, BAD_iter, buckets, hash, alloc)
371 static_assert(SFINAEs_away<Container, BadIter, BadIter, std::size_t, Hash, Alloc>);
372 LIBCPP_STATIC_ASSERT(
373 SFINAEs_away<Container, OutputIter, OutputIter, std::size_t, Hash, Alloc>);
374 // Cannot deduce from (iter, iter, buckets, BAD_hash, alloc)
375 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, BadHash, Alloc>);
376 // Cannot deduce from (iter, iter, buckets, ALLOC_as_hash, alloc)
377 static_assert(SFINAEs_away<Container, Iter, Iter, std::size_t, AllocAsHash, Alloc>);
378 // Note: (iter, iter, buckets, hash, BAD_alloc) is interpreted as (iter, iter,
379 // buckets, hash, pred), which is valid because there are no requirements for
380 // the predicate.
382 // (init_list, buckets, hash)
384 // Cannot deduce from (init_list, buckets, BAD_hash)
385 static_assert(SFINAEs_away<Container, InitList, std::size_t, BadHash>);
386 // Note: (init_list, buckets, ALLOC_as_hash) is interpreted as (init_list,
387 // buckets, alloc), which is valid.
389 // (init_list, buckets, hash, pred)
391 // Cannot deduce from (init_list, buckets, BAD_hash, pred)
392 static_assert(SFINAEs_away<Container, InitList, std::size_t, BadHash, Pred>);
393 // Cannot deduce from (init_list, buckets, ALLOC_as_hash, pred)
394 static_assert(SFINAEs_away<Container, InitList, std::size_t, AllocAsHash, Pred>);
395 // Note: (init_list, buckets, hash, ALLOC_as_pred) is interpreted as
396 // (init_list, buckets, hash, alloc), which is valid.
398 // (init_list, buckets, hash, pred, alloc)
400 // Cannot deduce from (init_list, buckets, BAD_hash, pred, alloc)
401 static_assert(
402 SFINAEs_away<Container, InitList, std::size_t, BadHash, Pred, Alloc>);
403 // Cannot deduce from (init_list, buckets, ALLOC_as_hash, pred, alloc)
404 static_assert(
405 SFINAEs_away<Container, InitList, std::size_t, AllocAsHash, Pred, Alloc>);
406 // Cannot deduce from (init_list, buckets, hash, ALLOC_as_pred, alloc)
407 static_assert(
408 SFINAEs_away<Container, InitList, std::size_t, Hash, AllocAsPred, Alloc>);
409 // Cannot deduce from (init_list, buckets, hash, pred, BAD_alloc)
410 static_assert(
411 SFINAEs_away<Container, InitList, std::size_t, Hash, Pred, BadAlloc>);
413 // (init_list, buckets, alloc)
415 // Note: (init_list, buckets, BAD_alloc) is interpreted as (init_list,
416 // buckets, hash), which is valid because the only requirement for the hash
417 // parameter is that it's not integral.
419 // (init_list, buckets, hash, alloc)
421 // Cannot deduce from (init_list, buckets, BAD_hash, alloc)
422 static_assert(SFINAEs_away<Container, InitList, std::size_t, BadHash, Alloc>);
423 // Cannot deduce from (init_list, buckets, ALLOC_as_hash, alloc)
424 static_assert(SFINAEs_away<Container, InitList, std::size_t, AllocAsHash, Alloc>);
426 // (init_list, alloc)
428 // Cannot deduce from (init_list, BAD_alloc)
429 static_assert(SFINAEs_away<Container, InitList, BadAlloc>);
431 #if TEST_STD_VER >= 23
432 using Range = RangeT<ValueType>;
433 using BadRange = BadRangeT<ValueType>;
435 // (from_range, range)
437 // Can deduce from (from_range, range)
438 static_assert(!SFINAEs_away<Container, std::from_range_t, Range>);
439 // Cannot deduce from (from_range, BAD_range)
440 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange>);
442 // (from_range, range, buckets)
444 // Can deduce from (from_range, range, buckets)
445 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t>);
446 // Cannot deduce from (from_range, BAD_range, buckets)
447 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t>);
449 // (from_range, range, buckets, hash)
451 // Can deduce from (from_range, range, buckets, hash)
452 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash>);
453 // Cannot deduce from (from_range, BAD_range, buckets, hash)
454 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash>);
455 // Cannot deduce from (from_range, range, buckets, BAD_hash)
456 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash>);
458 // (from_range, range, buckets, hash, pred)
460 // Can deduce from (from_range, range, buckets, hash, pred)
461 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Pred>);
462 // Cannot deduce from (from_range, BAD_range, buckets, hash, pred)
463 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash, Pred>);
464 // Cannot deduce from (from_range, range, buckets, BAD_hash, pred)
465 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash, Pred>);
467 // (from_range, range, buckets, hash, pred, alloc)
469 // Can deduce from (from_range, range, buckets, hash, pred, alloc)
470 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Pred, Alloc>);
471 // Cannot deduce from (from_range, BAD_range, buckets, hash, pred, alloc)
472 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash, Pred, Alloc>);
473 // Cannot deduce from (from_range, range, buckets, BAD_hash, pred, alloc)
474 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash, Pred, Alloc>);
475 // Cannot deduce from (from_range, range, buckets, hash, pred, BAD_alloc)
476 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Pred, BadAlloc>);
478 // (from_range, range, buckets, alloc)
480 // Can deduce from (from_range, range, buckets, alloc)
481 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Alloc>);
482 // Cannot deduce from (from_range, BAD_range, buckets, alloc)
483 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Alloc>);
484 // Note: (from_range, range, buckets, BAD_alloc) is interpreted as (from_range, range, buckets, hash), which is valid
485 // because the only requirement for the hash parameter is that it's not integral.
487 // (from_range, range, alloc)
489 // Can deduce from (from_range, range, alloc)
490 // TODO(LWG 2713): uncomment this test once the constructor is added.
491 // static_assert(!SFINAEs_away<Container, std::from_range_t, Range, Alloc>);
492 // Cannot deduce from (from_range, BAD_range, alloc)
493 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, Alloc>);
494 // Cannot deduce from (from_range, range, BAD_alloc)
495 static_assert(SFINAEs_away<Container, std::from_range_t, Range, BadAlloc>);
497 // (from_range, range, buckets, hash, alloc)
499 // Can deduce from (from_range, range, buckets, hash, alloc)
500 static_assert(!SFINAEs_away<Container, std::from_range_t, Range, std::size_t, Hash, Alloc>);
501 // Cannot deduce from (from_range, BAD_range, buckets, hash, alloc)
502 static_assert(SFINAEs_away<Container, std::from_range_t, BadRange, std::size_t, Hash, Alloc>);
503 // Cannot deduce from (from_range, range, buckets, BAD_hash, alloc)
504 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, BadHash, Alloc>);
505 // Cannot deduce from (from_range, range, buckets, ALLOC_as_hash, alloc)
506 static_assert(SFINAEs_away<Container, std::from_range_t, Range, std::size_t, AllocAsHash, Alloc>);
507 // Cannot deduce from (from_range, range, buckets, hash, BAD_alloc)
508 // Note: (from_range, range, buckets, hash, BAD_alloc) is interpreted as (from_range, range, buckets, hash, pred),
509 // which is valid because the only requirement for the predicate parameter is that it does not resemble an allocator.
510 #endif
513 #endif // TEST_SUPPORT_DEDUCTION_GUIDES_SFINAE_CHECKS_H