[clang] [Clang] Fix a crash when dumping a pack indexing type. (PR #80439)

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 4 14:28:05 PST 2024


bjope wrote:

@cor3ntin , our downstream code is doing some extra semantic checks using code like this in Sema::CheckVariableDeclarationType:

```
  if (!T->isIncompleteType() && !isDependentOrGNUAutoType(T) && !T->isPlaceholderType()) {
    uint64_t Size = Context.getTypeSizeInChars(T).getQuantity();
   ...
  }
```
That is hitting the infinite recursion.

So we protect the type size calculation by checking if the type is incomplete, dependent, etc.
But as Bevin pointed out here https://github.com/llvm/llvm-project/pull/72644/files#r1469490392 the "broken" PackIndexingType isn't reported as isDependent, and neither as isIncomplete.

I must say that I don't know that much about this to say what is correct. Maybe out downstream semantic checks should be protected in some more way to avoid this problem.

https://github.com/llvm/llvm-project/pull/80439


More information about the cfe-commits mailing list