On 10/7/24 3:35 PM, Simon Martin wrote:
On 7 Oct 2024, at 18:58, Jason Merrill wrote:
On 10/7/24 11:27 AM, Simon Martin wrote:
/* Now give a warning for all base functions without overriders,
as they are hidden. */
for (tree base_fndecl : base_fndecls)
+ {
+ if (!base_fndecl || overriden_base_fndecls.contains
(base_fndecl))
+ continue;
+ tree *hider = hidden_base_fndecls.get (base_fndecl);
+ if (hider)
How about looping over hidden_base_fndecls instead of base_fndecls?
Unfortunately it does not work because a given base method can be hidden
by one overload and overriden by another, in which case we don’t want
to warn (see for example AA:foo(int) in Woverloaded-virt7.C). So we need
to take both collections into account.
Yes, you'd still need to check overridden_base_fndecls.contains, but
that doesn't seem any different iterating over hidden_base_fndecls
instead of base_fndecls.
Or you could first iterate over overridden_base_fndecls and remove its
elements from hidden_base_fndecls.
Jason