Skip to content

Commit ce21d5c

Browse files
committed
test: add lookup test case
1 parent 7c0c4fb commit ce21d5c

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@ main: () = {
8686
_ = :<T> () = { _ = :() = { _ = :(x: T::value_type) = { _ = :() = {}; }; }; };
8787
_ = :<T> () = { _ = :(x: T::value_type) = { _ = :() = { _ = :() = {}; }; }; };
8888
_ = :<T> (x: T::value_type) = { _ = :() = { _ = :() = { _ = :() = {}; }; }; };
89+
90+
// Lookup.
91+
{
92+
alias: type == std::integral_constant<i32, 0>;
93+
_ = :alias::value_type = 0; // Non-dependent.
94+
}
95+
_ = :<T> (_: T) = {
96+
alias: type == std::integral_constant<T, 0>;
97+
_ = :alias::value_type = 0; // Dependent.
98+
{
99+
alias: type == std::integral_constant<i32, 0>;
100+
_ = :alias::value_type = 0; // Non-dependent.
101+
}
102+
}(0);
89103
}
90104

91105
v: <T> type = {

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

Lines changed: 21 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 91 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
14+
#line 105 "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 91 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
48+
#line 105 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
4949
template<typename T> class v {
5050
public: explicit v(T const& x);
51-
#line 92 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
51+
#line 106 "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 93 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
56+
#line 107 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
5757
};
5858

5959

@@ -138,13 +138,27 @@ auto main() -> int{
138138
(void) []<typename T>() -> void{(void) []() -> void{(void) [](cpp2::in<typename T::value_type> x) -> void{(void) []() -> void{}; }; }; };
139139
(void) []<typename T>() -> void{(void) [](cpp2::in<typename T::value_type> x) -> void{(void) []() -> void{(void) []() -> void{}; }; }; };
140140
(void) []<typename T>(cpp2::in<typename T::value_type> x) -> void{(void) []() -> void{(void) []() -> void{(void) []() -> void{}; }; }; };
141+
142+
// Lookup.
143+
{
144+
using alias = std::integral_constant<cpp2::i32,0>;
145+
(void) alias::value_type{0};// Non-dependent.
146+
}
147+
(void) []<typename T>(T const& _) -> void{
148+
using alias = std::integral_constant<T,0>;
149+
(void) typename alias::value_type{0};// Dependent.
150+
{
151+
using alias = std::integral_constant<cpp2::i32,0>;
152+
(void) typename alias::value_type{0};// Non-dependent.
153+
}
154+
}(0);
141155
}
142156

143-
#line 92 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
157+
#line 106 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
144158
template <typename T> v<T>::v(T const& x){}
145-
#line 92 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
159+
#line 106 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
146160
template <typename T> auto v<T>::operator=(T const& x) -> v& {
147161
return *this;
148-
#line 92 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
162+
#line 106 "pure2-bugfix-for-dependent-types-and-deducible-parameters.cpp2"
149163
}
150164

0 commit comments

Comments
 (0)