> "special"
It wouldn't be my code if it didn't have sp3ling mstakes innit! Actually to be fair I already changed that spelling mistake a few days ago in my local code ;) I was actually thinking about this last night as I was falling asleep (as you do) and I realised that the whole of my using decl lookup is redundant. I can simply do this (formatting probably messes up here): /* 1. If the "using" keyword is used to inherit DECL within the parent, this may cause DECL to be private, so we should return the using statement as the source of the problem. Scan the fields of PARENT_BINFO and see if there are any using decls. If there are, see if they inherit DECL. If they do, that's where DECL must have been declared private. */ for (tree parent_field = TYPE_FIELDS (BINFO_TYPE (parent_binfo)); parent_field; parent_field = DECL_CHAIN (parent_field)) { /* Not necessary, but also check TREE_PRIVATE for the sake of eliminating obviously non-relevant using decls. */ if (TREE_CODE (parent_field) == USING_DECL && TREE_PRIVATE (parent_field)) { /* If the using statement inherits DECL, it is the source of the access failure, so return it. */ if (cp_tree_equal (strip_using_decl (parent_field), decl)) return parent_field; } } I was wrong to say that the using decl does not store "where it came from/what it inherits" - that's exactly what strip_using_decl achieves. I think the problem was that when I did my initial testing in trying out ways to get the original decl, I didn't strip it, so the comparison failed, which led me to make the whole redundant lookup, blah blah blah. I've run a quick test and it seems to work, even with the overloads. Will test it some more and if all's good I will probably send a new patch some time this weekend. > I was thinking you could walk through the overload set to see if it > contains DECL. I did try that ... sort of. I did a name lookup on the using decl and that returned a baselink (no idea why, since the lookup function says it returns a tree list [probably me being dumb]), which then gave me a bunch of overloads. But that didn't seem to help since if multiple using decls give me the answer I'm looking for (a match for DECL) because they were overloaded, then there was no way for me to tell which using decl was actually the correct one. Kind of like if three cakes are equally as tasty, then how are you supposed to tell which one is the most delicious? Anthony