[clang] [Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent base classes (PR #84050)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 1 10:02:43 PDT 2024


================
@@ -990,6 +970,18 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
                                const Scope *S,
                                bool SuppressQualifierCheck,
                                ActOnMemberAccessExtraArgs *ExtraArgs) {
+  assert(!SS.isInvalid() && "nested-name-specifier cannot be invalid");
+  if (R.wasNotFoundInCurrentInstantiation() ||
+#if 0
----------------
sdkrystian wrote:

The inactive branch of the `#if` directive is left over from when `LookupMemberExprInRecord` would call `LookupQualified` directly. Since it now calls `LookupParsedName`, `R.wasNotFoundInCurrentInstantiation()` will be `true` when the _nested-name-specifier_ in the _id-expression_ of the class member access expression is dependent, so this check is no longer necessary. I'll remove it.

https://github.com/llvm/llvm-project/pull/84050


More information about the cfe-commits mailing list