================ @@ -8522,6 +8522,22 @@ bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl *FD) { } } + // We don't support 'counted_by' on flexible array members in substructures. + const DeclContext *DC = FD->getParent(); + while (const auto *RD = dyn_cast<RecordDecl>(DC)) { + if (!RD->isAnonymousStructOrUnion() || + !isa<RecordDecl>(RD->getLexicalParent())) + break; + DC = RD->getLexicalParent(); + } ---------------- bwendling wrote:
Not really. I'm checking to make sure that the `RecordDecl`'s lexical parent is also a `RecordDecl`. I need to do this, otherwise `DC` will end up as `TranslationUnit` in some cases. https://github.com/llvm/llvm-project/pull/73730 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits