[PATCH] D94987: DR39: Perform ambiguous subobject checks for class member access as part of object argument conversion, not as part of name lookup.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 10:52:07 PST 2021


rsmith created this revision.
rsmith added a reviewer: rjmccall.
rsmith requested review of this revision.
Herald added a project: clang.

Under C++ core issue 39, the rules for class-scope name lookup were reworked so
that name lookup no longer concerns itself with whether the names were found in
an ambiguous subobject.  The checks for an ambiguous subobject are now done as
part of conversion of the object argument in a member access (if needed)
instead.

One other important consequence of the new lookup rule is that it's now OK to
find different lookup results in multiple different classes, so long as the
same set of entities is found in each case (in any order, perhaps with
duplicates, and in the type case, perhaps via unrelated typedef declarations).

This patch implements the new lookup rule. This also has some follow-on impact
on access checks: it's now OK for name lookup to find different member
declarations in different base classes so long as they all resolve to the same
set of entities, so we now need to compute what the corresponding found
declaration is, and access-check it, for each path independently.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94987

Files:
  clang/include/clang/AST/CXXInheritance.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/DelayedDiagnostic.h
  clang/include/clang/Sema/Lookup.h
  clang/lib/Sema/SemaAccess.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/test/CXX/class.derived/class.member.lookup/p6.cpp
  clang/test/CXX/class.derived/class.member.lookup/p8.cpp
  clang/test/CXX/class.derived/class.member.lookup/p9.cpp
  clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/CXX/drs/dr1xx.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/test/CXX/drs/dr4xx.cpp
  clang/test/CXX/temp/temp.res/temp.local/p3.cpp
  clang/test/SemaCXX/access.cpp
  clang/test/SemaCXX/lookup-member.cpp
  clang/test/SemaCXX/member-name-lookup.cpp
  clang/test/SemaCXX/microsoft-dtor-lookup.cpp
  clang/test/SemaCXX/new-delete.cpp
  clang/test/SemaTemplate/dependent-base-classes.cpp
  clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp
  clang/test/SemaTemplate/temp.cpp
  clang/www/cxx_dr_status.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94987.317628.patch
Type: text/x-patch
Size: 59299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210119/8bac7c5d/attachment-0001.bin>


More information about the cfe-commits mailing list