reject_undefined_variadic_type.mx raw

   1  // expected: undefined: Undefined
   2  //
   3  // A variadic parameter whose element type cannot be resolved is an error, never
   4  // a `void` parameter. Every DotsType case used to resolve its element and fall
   5  // through to nil, while the `variadic` flag is read from the AST shape
   6  // independently - so the parameter became `void` and callers still built a slice
   7  // for it:
   8  //
   9  //	%t4 = getelementptr inbounds i8, ptr %t3, i32 0   ; GEP of the slice VALUE
  10  //	call void @main.f(void %t3, ptr null)
  11  //
  12  // clang rejects that, and when a scope happened to carry the binding the slice
  13  // construction computed a garbage element size instead and the compiler panicked
  14  // with "alloc: implausible size".
  15  //
  16  // The BARE name is deliberate. The same fixture with a QUALIFIED unresolved name
  17  // (`...fmt.Stringer` in a file that does not import fmt) makes the compiler
  18  // segfault in runtime.memcpy on roughly 2-7% of runs - see the work log,
  19  // round 81 - so this pins the rule without carrying that flake in the suite.
  20  package main
  21  
  22  func f(args ...Undefined) {}
  23  
  24  func main() {
  25  	f()
  26  }
  27