Opened 5 years ago
Last modified 3 years ago
#214 closed defect
C Errors in dtype/ttype combination with Generic struct/union — at Initial Version
Reported by: | m3zulfiq | Owned by: | |
---|---|---|---|
Priority: | major | Component: | cfa-cc |
Version: | 1.0 | Keywords: | dtype, ttype, generic struct, union |
Cc: |
Description
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;
}