﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
221	Reference to Value Assertion Passes Value	ajbeach		"If you have an assertion that calls for a reference to a value and have an instance of that value (with the correct name and type) that value will resolve to match the reference (as expected) but the code will not generate properly.

The value will be passed in directly which doesn't work because the type has been converted into a pointer for C compatibility. Adding a `&` would fix this but it has not been added.

Minimal Reproduction:
{{{
struct Cell {
    int x;
};

trait has_cell(dtype T) {
    Cell & cell_instance;
    int & int_instance;
};

Cell cell_instance = { -7 };
int int_instance = -7;

forall(dtype T | has_cell(T))
void func(T & _) {}

int main(int argc, char * argv[]) {
    char x;
    func(x);
    return 0;
}
}}}

Error Message:
{{{
CFA Version 1.0.0 (debug)
minimal.cfa: In function '_X4mainFi_iPPc__1':
minimal.cfa:18:83: error: incompatible type for argument 1 of '_X4funcQ1_0_0_2__X13cell_instanceS4Cell_X12int_instancei_Fv_BD0__1'
   18 |  func(x);
      |                                                                                   ^                        
      |                                                                                   |
      |                                                                                   struct Cell
minimal.cfa:6:39: note: expected 'struct Cell *' but argument is of type 'struct Cell'
    6 |  Cell & cell_instance;
      |                                       ^                        
minimal.cfa:18:110: warning: passing argument 2 of '_X4funcQ1_0_0_2__X13cell_instanceS4Cell_X12int_instancei_Fv_BD0__1' makes pointer from integer without a cast [-Wint-conversion]
   18 |  func(x);
      |                                                                                                              ^                  
      |                                                                                                              |
      |                                                                                                              int
minimal.cfa:7:38: note: expected 'int *' but argument is of type 'int'
    7 |  int & int_instance;
      |  ~~~~~~~~~~~~~~~~~~~                 ^    
}}}

Likely source is that the LValue pass is run before the Box pass and some interaction from that. Which terrifies me."	defect	new	major	cfa-cc	1.0			
