﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
88	Arrays of references	Rob Schluntz		"Currently the subscript operation does not work for arrays of references:
{{{
int main() {
  int & x[10];
  x[3];
}

$ cfa test.c
error: No reasonable alternatives for expression Applying untyped: 
  Name: ?[?]
...to: 
  Name: x
  constant expression (3 3: signed int)
}}}

This is because subscript is defined as
{{{
forall( dtype T | sized(T) ) T & ?[?]( T *, ptrdiff_t );
}}}
And type parameters do not currently bind to reference types. To make this work correctly, we want to allow bare type variables to strip references, but not otherwise. 

Changing this line in `bindVar` in Unify.cc from
{{{
other = other->stripReferences();
}}
to
{{{
if ( widenMode.widenSecond ) other = other->stripReferences();
}}}
strips references for bare type parameters and not otherwise, as desired. For one reason or another this causes a 2x slowdown. "	defect	new	minor	cfa-cc	1.0		reference array subscript	
