[PATCH] D80295: [Sema] Diagnose static data members in classes nested in unnamed classes

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 20 23:25:49 PDT 2020


rjmccall added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:6904
             << Name << RD->getTagKind();
           Invalid = true;
+        } else if (RD->isLocalClass()) {
----------------
This diagnostic actually ignores the tag kind that passed down to it, which should be fixed.  Also, you should pass in the tag kind for the actual anonymous class you found.

While I'm looking at this code: `isLocalClass` is mis-designed and doesn't work for any of our non-`FunctionDecl` local contexts.  This check should be `if (RD->getParentFunctionOrMethod())`.


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

https://reviews.llvm.org/D80295





More information about the cfe-commits mailing list