Skip to content

Unions that convert () to a reference don't work聽#507

Description

@fee1-dead

This came up at #420, see more details there. Basic repro (a copy of MaybeUninit):

// build-pass

#[spirv_std::spirv(fragment)]
pub fn main() {
    union A { x: (), y: &'static glam::Vec4 }
    let a = A { x: () };
}

Activity

  1. fee1-dead commented on Jan 8, 2026

    @fee1-dead
    CollaboratorAuthor

    One hacky workaround would be:

        fn store(&mut self, val: Self::Value, ptr: Self::Value, _align: Align) -> Self::Value {
            if let SpirvType::Pointer { pointee } = self.lookup_type(val.ty) && let SpirvType::Void = self.lookup_type(pointee) { 
                return val;
            }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions