Skip to content

Commit 44d6a65

Browse files
committed
[libc++][ranges]test: add static_assert verification for ranges::to
1 parent 7515cdb commit 44d6a65

File tree

1 file changed

+17
-0
lines changed
  • libcxx/test/libcxx/ranges/range.utility/range.utility.conv

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <ranges>
2+
3+
4+
5+
void test(){
6+
struct R {
7+
int* begin() const{reurn nullptr;};
8+
int* end() const{return nullptr;};
9+
10+
operator int() const { return 0; }
11+
};
12+
(void)std::ranges::to<int>(R{});
13+
//expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}}
14+
(void)(R{} | std::ranges::to<int>());
15+
//expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}}
16+
17+
}

0 commit comments

Comments
 (0)