Opened 8 years ago
Closed 7 years ago
#42 closed defect (fixed)
Generic index
Reported by: | Thierry Delisle | Owned by: | |
---|---|---|---|
Priority: | major | Component: | cfa-cc |
Version: | 1.0 | Keywords: | Index Generic |
Cc: |
Description ¶
forall( dtype T ) struct ptr_t { T * ptr; }; forall( dtype T | sized( T ) ) T& ?[?]( ptr_t( T ) & this, ptrdiff_t idx ) { return this.ptr[idx]; }
yields
test.c: In function ‘___operator_index__A0_1_0_0__FRd0_R6sptr_tl__1’: test.c:22:56: warning: dereferencing ‘void *’ pointer } ^ test.c:22:5: error: invalid use of void expression }
Change History (4)
comment:1 Changed 8 years ago by
Priority: | blocker → major |
---|
comment:2 Changed 8 years ago by
comment:3 Changed 7 years ago by
This works as a workaround :
forall( dtype T ) struct ptr_t { T * ptr; }; forall( dtype T | sized( T ) ) T& ?[?]( ptr_t( T ) & this, ptrdiff_t idx ) { return ((typeof(this.ptr))this.ptr)[idx]; }
comment:4 Changed 7 years ago by
Owner: | set to Rob Schluntz <rschlunt@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
In b95fe40:
Note: See
TracTickets for help on using
tickets.
I took a quick look at this. Prior to the Box pass, this code looks right:
But the Box pass does not correctly handle this use of subscripting, since ptr_t is dtype-static and has already been monomorphized. If you add the sized(T) assertion to the ptr_t definition, it works since ptr_t is not monomorphized.