﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
59	Unsized generics have incorrect pointer arithmetic	Thierry Delisle	Rob Schluntz <rschlunt@…>	"The following program produces an incorrect result:
{{{
#include <fstream>

forall(dtype T)
struct wrapper{
	T * ptr;
	int size;
};

typedef long long int type_t;

int main() {
	type_t a[10];
	wrapper(type_t) w = {a, 10};

	type_t * start_w = w.ptr;
	type_t * end_w   = w.ptr + w.size;

	sout | start_w | ""+ ("" | w.size | ""*"" | sizeof(type_t) | "") == "" | end_w | endl;
}
}}}
The result should be :
{{{
0x7fffb3dc1d50 + (10 * 8) == 0x7fffb3dc1da0
}}}
The actual result is :
{{{
0x7fffb3dc1d50 + (10 * 8) == 0x7fffb3dc1d5a
}}}
(Addresses may vary)

This is because the size of the type is not used.
The problem cause away by adding the ""sized"" constraint to the generic type.

Possible fixes:
 - Disallow pointer arithmetic in this case.
 - Somehow get the size."	defect	closed	major	cfa-cc	1.0	fixed		
