﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
214	C Errors in dtype/ttype combination with Generic struct/union	m3zulfiq		"The following code gives C-style errors about sizeof T in generic struct/union on compiling with CFA.

forall( dtype T | sized(T) ) { // Removing sized assertion gives CFA error ""T declared void""
	union  U_fill 	{ char c; T * a; T t; };
	struct SS_fill 	{ char tag; U_fill(T) fill; };
}

static inline forall( dtype T | sized(T) ) {
	T * $balloc_internal( void * Resize, void * Realloc, size_t Align, size_t Dim, SS_fill(T) Fill) {
		return (T*)0p;
	} // $balloc_internal

	forall( ttype TT | { T * $balloc_internal( void *, void *, size_t, size_t, SS_fill(T), TT ); } ) {
	    T * balloc( TT all ) {
	        return $balloc_internal( (void*)0p, (void*)0p, 16, 1, (SS_fill(T)){'0', (U_fill(T)){'0'}}, all);
	    } // balloc
	} // distribution TT
} // distribution T

int main() {
	int * abc = balloc();
	free(abc);
	return 0;
}"	defect	new	major	cfa-cc	1.0		dtype, ttype, generic struct, union	
