Skip to content

Commit eab1a1d

Browse files
authored
[libc++][test] Improve test coverage for flat_set (lack of) SCARY iterators (#139649)
Missing from 5e94e26.
1 parent cbc2ef0 commit eab1a1d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
//===----------------------------------------------------------------------===//
8+
9+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10+
11+
// <flat_set>
12+
13+
// class flat_set
14+
// class flat_multiset
15+
16+
// Extension: SCARY/N2913 iterator compatibility between flat_set and flat_multiset
17+
// Test for the absence of this feature
18+
19+
#include <flat_set>
20+
#include <type_traits>
21+
22+
#include "test_macros.h"
23+
24+
void test() {
25+
typedef std::flat_set<int, int> M1;
26+
typedef std::flat_multiset<int, int> M2;
27+
28+
static_assert(!std::is_convertible_v<M1::iterator, M2::iterator>);
29+
static_assert(!std::is_convertible_v<M2::iterator, M1::iterator>);
30+
31+
static_assert(!std::is_convertible_v<M1::const_iterator, M2::const_iterator>);
32+
static_assert(!std::is_convertible_v<M2::const_iterator, M1::const_iterator>);
33+
}

0 commit comments

Comments
 (0)