On 2/4/21 11:24 AM, Jason Merrill wrote:
On 2/4/21 10:02 AM, Anthony Sharp via Gcc-patches wrote:
Hello,
New bugfix for PR19377
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19377). This is
basically an extension of what I did before for PR17314 except it also
fixes this other bug.
I hope I didn't over-comment in the code ... better to say too much
than too little! It's a niche bug so I thought it could do with a
little explanation.
Yes, thanks; it would take a lot to make me request less comments.
+ if (TREE_CODE (parent_field) == USING_DECL)
+ {
+ if (cp_tree_equal (decl,
+ lookup_member (parent_binfo,
+ DECL_NAME (parent_field),
+ /*protect=*/0,
+ /*want_type=*/false,
+ tf_warning_or_error)))
Isn't it sufficient to check that the names match?
Well, I guess it could be using a declaration of the same name from
another base. But in that case you could end up with an overload set
containing both the decl we're complaining about and another of the same
name from another base, in which case the lookup result would include
both, and so the comparison would fail and we would fall through to the
private base assumption.
But checking the name is a simple way to skip irrelevant usings.
Maybe also check that the using is TREE_PRIVATE?
tree parent_binfo = get_parent_with_private_access (decl,
-
basetype_path);
+
basetype_path);
...
+ diag_location = get_class_access_diagnostic_decl
(parent_binfo,
+
diag_decl);
The second lines of arguments are indented one space too far in both
these calls.
Jason