Fix lambda parameter types in queue min and max (#7962)

Signed-off-by: Bartosz Skorowski <bskorowski@internships.antmicro.com>
This commit is contained in:
Bartosz Skorowski 2026-07-20 12:53:40 +02:00 committed by GitHub
parent 3924fe9c18
commit 176e333774
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View File

@ -36,6 +36,7 @@ Artur Bieniek
AUDIY
Aylon Chaim Porat
Bartłomiej Chmiel
Bartosz Skorowski
Benjamin Collier
Brian Li
Cameron Kirk

View File

@ -932,7 +932,7 @@ public:
VlQueue min(T_Func with_func) const {
if (m_deque.empty()) return VlQueue{};
const auto it = std::min_element(m_deque.cbegin(), m_deque.cend(),
[&with_func](const IData& a, const IData& b) {
[&with_func](const T_Value& a, const T_Value& b) {
return with_func(0, a) < with_func(0, b);
});
return VlQueue::consV(*it);
@ -946,7 +946,7 @@ public:
VlQueue max(T_Func with_func) const {
if (m_deque.empty()) return VlQueue{};
const auto it = std::max_element(m_deque.cbegin(), m_deque.cend(),
[&with_func](const IData& a, const IData& b) {
[&with_func](const T_Value& a, const T_Value& b) {
return with_func(0, a) < with_func(0, b);
});
return VlQueue::consV(*it);

View File

@ -35,6 +35,7 @@ module t;
bit b;
string string_q[$];
string string_qv[$];
string string_qe[$];
point_3d points_q[$]; // Same as q and qv, but complex value type
point_3d points_qv[$];
Cls cls;
@ -180,6 +181,19 @@ module t;
qv = qe.max;
`checkp(qv, "'{}");
string_qv = string_q.min;
`checks(string_qv[0], "A");
string_qv = string_q.min(x) with (int'(x[0]) + 10);
`checks(string_qv[0],"A");
string_qv = string_q.max;
`checks(string_qv[0], "b");
string_qv = string_q.max(x) with (int'(x[0]) + 10);
`checks(string_qv[0],"b");
string_qv = string_qe.min;
`checkp(string_qv,"'{}");
string_qv = string_qe.max;
`checkp(string_qv,"'{}");
// Reduction methods
i = q.sum;
`checkh(i, 32'hc);