Skip to content

Commit 8f224e2

Browse files
committed
fix(cpp1): stop lookup at first match
1 parent 83f7c93 commit 8f224e2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/cppfront.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,8 +1797,9 @@ class cppfront
17971797
looking_up.push_back(&lookup_id);
17981798
auto guard = finally([&]{ looking_up.pop_back(); });
17991799

1800+
bool res = false;
18001801
// If any parent declaration
1801-
return std::any_of(current_declarations.rbegin(), current_declarations.rend() - 1, [&](declaration_node const* decl) {
1802+
std::find_if(current_declarations.rbegin(), current_declarations.rend() - 1, [&](declaration_node const* decl) {
18021803
// that can have aliases
18031804
if ((decl->is_function()
18041805
|| decl->is_type()
@@ -1819,14 +1820,17 @@ class cppfront
18191820
&& *decl->identifier->identifier == lookup_id) {
18201821
auto& type_id = get<alias_node::a_type>(alias->initializer);
18211822
// and its value is a dependent _type-id_.
1822-
return is_dependent(*type_id);
1823+
res = is_dependent(*type_id);
1824+
return true;
18231825
}
18241826
}
18251827
return false;
18261828
});
18271829
}
18281830
return false;
18291831
});
1832+
1833+
return res;
18301834
}
18311835

18321836
auto is_dependent(const type_id_node& n)

0 commit comments

Comments
 (0)