Skip to content

Commit ed5cd03

Browse files
committed
test: use the test case from hsutter#597
1 parent 7e65a71 commit ed5cd03

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
pair: <L: _, R: _> type = { }
2-
g: (x: pair<:i32 = (0), :i32 = (0)>) = { }
3-
main: () = { }
1+
u: type == std::array<i32, 2>;
2+
t: @struct type = {
3+
this: std::integral_constant<u, :u = (17, 29)>;
4+
}
5+
main: () = {
6+
[[assert Testing: t::value[0] == 17]]
7+
[[assert Testing: t::value[1] == 29]]
8+
}

regression-tests/test-results/pure2-bugfix-for-non-local-initialization.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,27 @@
66

77
#include "cpp2util.h"
88

9-
#line 1 "pure2-bugfix-for-non-local-initialization.cpp2"
10-
template<auto L, auto R> class pair;
119

10+
#line 2 "pure2-bugfix-for-non-local-initialization.cpp2"
11+
class t;
12+
1213

1314
//=== Cpp2 type definitions and function declarations ===========================
1415

1516
#line 1 "pure2-bugfix-for-non-local-initialization.cpp2"
16-
template<auto L, auto R> class pair {
17-
public: pair() = default;
18-
public: pair(pair const&) = delete; /* No 'that' constructor, suppress copy */
19-
public: auto operator=(pair const&) -> void = delete;
17+
using u = std::array<cpp2::i32,2>;
18+
class t: public std::integral_constant<u,u{17, 29}> {
2019

21-
#line 1 "pure2-bugfix-for-non-local-initialization.cpp2"
2220
};
23-
auto g(cpp2::in<pair<cpp2::i32{0},cpp2::i32{0}>> x) -> void;
2421
auto main() -> int;
25-
22+
2623

2724
//=== Cpp2 function definitions =================================================
2825

2926

30-
#line 2 "pure2-bugfix-for-non-local-initialization.cpp2"
31-
auto g(cpp2::in<pair<cpp2::i32{0},cpp2::i32{0}>> x) -> void{}
32-
auto main() -> int{}
27+
#line 5 "pure2-bugfix-for-non-local-initialization.cpp2"
28+
auto main() -> int{
29+
cpp2::Testing.expects(cpp2::assert_in_bounds(t::value, 0)==17, "");
30+
cpp2::Testing.expects(cpp2::assert_in_bounds(t::value, 1)==29, "");
31+
}
3332

0 commit comments

Comments
 (0)