diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-07-10 21:08:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-10 21:08:33 +0200 |
commit | f354836e934f292fffe5cc62130c5868c11085a7 (patch) | |
tree | e2fa76eb892ed924b6d59ca4f0a55f8b19f314b0 /src | |
parent | 3dc22fd9777917fe4953665d914204d02e22a587 (diff) | |
parent | e0fc5ca733521dcd926f9de6e17ba4dc3304da25 (diff) |
Merge pull request #1592 from emilio/incomplete-array-layout
ir: Properly find the layout of incomplete arrays.
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/ty.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs index f54d4760..625b5f87 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -249,6 +249,12 @@ impl Type { self.layout.or_else(|| { match self.kind { TypeKind::Comp(ref ci) => ci.layout(ctx), + TypeKind::Array(inner, length) if length == 0 => { + Some(Layout::new( + 0, + ctx.resolve_type(inner).layout(ctx)?.align, + )) + } // FIXME(emilio): This is a hack for anonymous union templates. // Use the actual pointer size! TypeKind::Pointer(..) => { |