[PATCH] D75922: [ASTImporter] Compare the DC of the underlying type of a FriendDecl

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 10 16:26:24 PDT 2020


shafik added a subscriber: rsmith.
shafik added a comment.

I believe that your main example violates basic.scope.class p2 <http://eel.is/c++draft/basic.scope.class#2>:

> A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S.
>  No diagnostic is required for a violation of this rule.

Although it is ill-formed no diagnostic required.

CC @rsmith



================
Comment at: clang/lib/AST/ASTImporter.cpp:3637
+// is a dependent type then the returned optional does not have a value.
+static Optional<DeclContext *> getDCOfUnderlyingDecl(FriendDecl *FrD) {
+  if (NamedDecl *ND = FrD->getFriendDecl())
----------------
It looks like we use `FriendDecl *D` in other places, we should try to be consistent across the file. 

I would not be against changing it but perhaps in a different PR?


================
Comment at: clang/lib/AST/ASTImporter.cpp:3656
+  // DependentType
+  return Optional<DeclContext *>();
+}
----------------
`return {}`;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75922





More information about the cfe-commits mailing list