The "no member" diagnostic is likely bogus.
Details
- Reviewers
sammccall - Group Reviewers
Restricted Project - Commits
- rGbf890dcb0f5e: [clang] Don't emit "no member" diagnostic if the lookup fails on an invalid…
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This seems like fixing a fairly specific case of a general problem: if the base class is invalid I would expect to see similar problems in other places (e.g. unqualified lookup from inside the class).
But it fixes a diagnostic the libc++ folks think is important...
clang/lib/Sema/SemaExpr.cpp | ||
---|---|---|
2584 | I found the wording of this example a bit hard to follow. What about "e.g. if a class is invalid because it's derived from an invalid base class, then missing members were likely supposed to be inherited". I'm actually not convinced this is merely an example - is there any other reason for invalidity other than invalid base class where this logic applies? | |
2586 | nit: will fails -> will fail | |
2588 | this is a fairly general check, but the reasoning really only applies to invalid bases. |
Fix a comment.
clang/lib/Sema/SemaExpr.cpp | ||
---|---|---|
2584 |
I suppose there are other examples, but failed to find one. | |
2588 | we don't record that the base specifier is not attached due to the invalidity, we could introduce a bit to do that, not sure it is worth for this particular case, might be worth to reconsider if we see large regressions (currently, we don't have any regressions in existing tests). |
I found the wording of this example a bit hard to follow.
What about "e.g. if a class is invalid because it's derived from an invalid base class, then missing members were likely supposed to be inherited".
I'm actually not convinced this is merely an example - is there any other reason for invalidity other than invalid base class where this logic applies?