# Recursive data structures error consistency

**URL:** <https://forums.swift.org/t/recursive-data-structures-error-consistency/84537>\
**Category:** Discussion\
**Tags:** inlinearray\
**Created:** [February 3, 2026, 11:58am UTC](https://forums.swift.org/t/recursive-data-structures-error-consistency/84537 "2026-02-03T11:58:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [February 3, 2026, 11:58am UTC](https://forums.swift.org/t/recursive-data-structures-error-consistency/84537/1 "2026-02-03T11:58:47Z")

</div>

I wonder if this recursive structure should fail to compile:

```swift
struct S {
    var x: InlineArray<1, S>
}
// or similar via intermediate types (S->D->S)

```

to make it aligned with other cases of recursive structures that fail to compile.

OTOH, unless I use it (say, make an instance of it, which I can't (unsafe bit casting aside)) it's probably benign to leave it compilable... But then it raises a similar question about consistency with the other cases of recursive structures (maybe they should compile, and fail to compile only if I were actually using them?)

---

<div class="post-metadata">

**Author:** ![MinerMinerMain](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/minerminermain/32/35300_2.png) [@MinerMinerMain](https://forums.swift.org/u/MinerMinerMain)\
**Post date:** [February 3, 2026, 4:12pm UTC](https://forums.swift.org/t/recursive-data-structures-error-consistency/84537/2 "2026-02-03T16:12:30Z")

</div>

> **[Swift Online Playground](https://swiftfiddle.com/cvv6wg3ndvaohl3dtszfk5paqe)**
>
> SwiftFiddle is an online playground for creating, sharing and embedding Swift fiddles (little Swift programs that run directly in your browser).

This doesn’t seem like a stable configuration for 6.2.3 compilation, at least in SwiftFiddle, where the function `swift::irgen::projectPhysicalStructMemberFromExplosion(swift::irgen::IRGenFunction&, swift::SILType, swift::irgen::Explosion&, swift::VarDecl*, swift::irgen::Explosion&)` crashed during IR emission for the getter of `x`: `@$s4main1SV1xs11InlineArrayVy$0_ACGvg`.

This doesn’t feel like a reasonable compilation and so should probably be obstructed before SIL gen especially since detecting potential pointer circular references could be the cost of traversing the entire polydimensional structure which could be created by this unconstrained structuring which can grow “infinitely” outwards which would be a pain for anyone to traverse through or use in any useful capacity. Since any safe checks on these structures would be detrimental to performance the compiler should likely not try to deal with atrociously defined structures which it would have to enforce safety guarantees onto.
