Skip to content

Commit 0ebac0d

Browse files
committed
test: add test case for value-dependent
1 parent 709a702 commit 0ebac0d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

regression-tests/pure2-bugfix-for-dependent-types.cpp2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ f: <T, V: T::value_type> (x: T::value_type) -> T::value_type = {
1010
// Dependent *template-id*s.
1111
_ = :identity<T>::value_type = (); // First identifier.
1212
_ = :std::optional<T>::value_type = (); // Non-first identifier.
13+
_ = :std::array<i32, T::value>::value_type = ();
1314

1415
// Emitted `template`.
1516
ptr: type == * T; // Needed, pending #502.

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "cpp2util.h"
88

99

10-
#line 46 "pure2-bugfix-for-dependent-types.cpp2"
10+
#line 47 "pure2-bugfix-for-dependent-types.cpp2"
1111
template<typename T> class t;
1212

1313

@@ -19,14 +19,14 @@ template<typename T> using identity = T;
1919
template<typename T, T::value_type V> [[nodiscard]] auto f(cpp2::in<typename T::value_type> x) -> T::value_type;
2020

2121

22-
#line 46 "pure2-bugfix-for-dependent-types.cpp2"
22+
#line 47 "pure2-bugfix-for-dependent-types.cpp2"
2323
template<typename T> class t {
2424
struct u_x_as_base { T::value_type x; };
2525

26-
#line 47 "pure2-bugfix-for-dependent-types.cpp2"
26+
#line 48 "pure2-bugfix-for-dependent-types.cpp2"
2727
public: class u: public u_x_as_base, public T::type {
2828

29-
#line 50 "pure2-bugfix-for-dependent-types.cpp2"
29+
#line 51 "pure2-bugfix-for-dependent-types.cpp2"
3030
};
3131
public: T::value_type x {0};
3232
};
@@ -48,6 +48,7 @@ template<typename T, T::value_type V> [[nodiscard]] auto f(cpp2::in<typename T::
4848
// Dependent *template-id*s.
4949
(void) typename identity<T>::value_type{};// First identifier.
5050
(void) typename std::optional<T>::value_type{};// Non-first identifier.
51+
(void) typename std::array<cpp2::i32,T::value>::value_type{};
5152

5253
// Emitted `template`.
5354
using ptr = T*; // Needed, pending #502.
@@ -81,7 +82,7 @@ template<typename T, T::value_type V> [[nodiscard]] auto f(cpp2::in<typename T::
8182
}
8283
}
8384

84-
#line 54 "pure2-bugfix-for-dependent-types.cpp2"
85+
#line 55 "pure2-bugfix-for-dependent-types.cpp2"
8586
auto main() -> int{
8687
using zero = std::integral_constant<cpp2::i32,0>;
8788
(void) f<zero,0>(0);

0 commit comments

Comments
 (0)