randyli planned changes to this revision.
randyli added inline comments.

================
Comment at: clang/lib/Sema/SemaExprMember.cpp:690
+    // int n = a.B::m;
+    if (BaseExpr && isa<CXXRecordDecl>(DC) && isa<CXXRecordDecl>(RDecl)) {
+      CXXRecordDecl *SRecord = cast<CXXRecordDecl>(DC)->getCanonicalDecl();
----------------
rjmccall wrote:
> We don't generally cite bug numbers in the source code; we just cite the 
> language rule.  You can reference the bug number in your test, though.
> 
> The standard says that this is an error even when the member access is 
> implicit, so the check for `BaseExpr` is incorrect.
> 
> Conversely, the standard says this is not an error when the declaration 
> referenced is not a non-static data member or member function, so you cannot 
> do this before the lookup; in fact, you cannot do it until we've fully 
> resolved the lookup, which may require contextual information.
> 
> All of the code paths that build a non-static member eventually funnel into 
> `BuildMemberExpr`, so maybe that's the right place for the check?  But note 
> that you have to check explicitly for a non-static member, because 
> `MemberExpr` is used for all of them.
> 
> Technically, this rule wasn't in C++98, but since it does appear in C++03, I 
> agree we should just enforce it unconditionally, as we usually treat C++03 as 
> an errata release rather than its own language mode.
ok,  thank you for the suggestion,  I'll look into BuildMemeberExpr and try 
again 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122460/new/

https://reviews.llvm.org/D122460

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to