Skip to content

Bad pointer dereference crash when using parameter pack #69947

@theblixguy

Description

@theblixguy
class Thing<T> {
  var value: T
  init(_ value: T) { self.value = value }

  func combineThings<each U>(head: Thing<T>, tail: repeat Thing<each U>) { 
    repeat (each tail).doSomething(each tail) { _ in }
  }

  func doSomething(_ value: AnyObject, closure: @escaping (T) -> Void) {}
}

This crashes on latest nightly (Swift version 5.11-dev (LLVM 82306b901067e3c, Swift cabb5e109fa373f)) with:

Archetype τ_2_0 not allowed in this context
Archetype generic signature: <τ_0_0, each τ_1_0, τ_2_0>
Context generic signature: <T, each U>

and further down it says

Program crashed: Bad pointer dereference at 0x0000000000000000

Similar crash on 5.9 too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.call expressionsFeature → expressions: Call expressionsclosuresFeature: closurescompilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareexpressionsFeature: expressionsgenericsFeature: generic declarations and typespack expansionsFeature → expressions: Pack expansion expressionsparameter packsFeature → generics: Parameter packsswift 6.0type checkerArea → compiler: Semantic analysisverifier

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions