[PATCH] D74103: Implement P1766R1: diagnose giving non-C-compatible classes a typedef name for linkage purposes.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 6 11:08:02 PST 2020


rjmccall added a comment.

Oh thank goodness, they finally fixed this.



================
Comment at: clang/lib/Sema/SemaDecl.cpp:4365
+  // C++ [dcl.typedef]p9: [P1766R1]
+  //   An unnamed class with a typedef name for linkage purposes shall not
+  if (RD->isInvalidDecl())
----------------
Starting the quote here makes it look like it's describing the invalid-decl short-circuit just below.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:4394
+        isa<EnumDecl>(D))
+      continue;
+
----------------
This is essentially part of the next paragraph.

I believe `friend` declarations also do not declare "members", under the same logic allowing `static_assert`.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:4404
+    if (MemberRD->isLambda())
+      return {NonCLikeKind::Lambda, MemberRD->getSourceRange()};
+
----------------
Do lambdas in nested expressions really get added to the class's decls list?  I wouldn't have expected that, but it definitely makes this check a lot easier.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74103





More information about the cfe-commits mailing list