================ @@ -8697,9 +8708,10 @@ static bool CheckCountedByAttrOnField( InvalidTypeKind = CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER; } - if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID) { + if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID && + !CountInBytes) { ---------------- hnrklssn wrote:
I think that is a reasonable restriction to add in `-fbounds-safety`, but for simply saying "this is the size", is it really an issue? It's also feasible to allow the attribute, but not allow indexing into an unsized type. That would make it possible to cast to `char * sized_by(sz)` and retain the size bounds before indexing into it. https://github.com/llvm/llvm-project/pull/93231 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits