Skip to content

Commit b8d0ba6

Browse files
committed
test: add more test cases for deducible parameters
1 parent ce21d5c commit b8d0ba6

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

regression-tests/pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ main: () = {
7171
// Deducible parameters.
7272
_ = :v = 0;
7373
_ = :<T> (x: std::vector<T>) = {}(:std::vector<i32> = ());
74+
_ = :<T> (x: std::vector<std::vector<T>>) = {}(:std::vector<std::vector<i32>> = ());
75+
// Uncomment once `typename` is supported for template arguments.
76+
// _ = :<T, U> (x: std::pair<T, typename U::value_type>, y: U) = {}(:std::pair = (0, 0), z);
7477
init(out z, z);
7578
id(z, z);
7679

regression-tests/test-results/pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
template<typename T> class t;
1212

1313

14-
#line 105 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
14+
#line 108 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
1515
template<typename T> class v;
1616

1717

@@ -45,15 +45,15 @@ template<typename T> auto id(cpp2::in<std::integral_constant<cpp2::i32,T::value>
4545
auto main() -> int;
4646

4747

48-
#line 105 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
48+
#line 108 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
4949
template<typename T> class v {
5050
public: explicit v(T const& x);
51-
#line 106 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
51+
#line 109 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
5252
public: auto operator=(T const& x) -> v& ;
5353

5454
public: v(v const&) = delete; /* No 'that' constructor, suppress copy */
5555
public: auto operator=(v const&) -> void = delete;
56-
#line 107 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
56+
#line 110 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
5757
};
5858

5959

@@ -123,6 +123,9 @@ auto main() -> int{
123123
// Deducible parameters.
124124
(void) v{0};
125125
(void) []<typename T>(std::vector<T> const& x) -> void{}(std::vector<cpp2::i32>{});
126+
(void) []<typename T>(std::vector<std::vector<T>> const& x) -> void{}(std::vector<std::vector<cpp2::i32>>{});
127+
// Uncomment once `typename` is supported for template arguments.
128+
// _ = :<T, U> (x: std::pair<T, typename U::value_type>, y: U) = {}(:std::pair = (0, 0), z);
126129
init(cpp2::out(&z.value()), z.value());
127130
id(z.value(), std::move(z.value()));
128131

@@ -154,11 +157,11 @@ auto main() -> int{
154157
}(0);
155158
}
156159

157-
#line 106 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
160+
#line 109 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
158161
template <typename T> v<T>::v(T const& x){}
159-
#line 106 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
162+
#line 109 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
160163
template <typename T> auto v<T>::operator=(T const& x) -> v& {
161164
return *this;
162-
#line 106 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
165+
#line 109 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
163166
}
164167

0 commit comments

Comments
 (0)