Opened 7 years ago

Closed 7 years ago

#29 closed defect (fixed)

sizeof(foo) does not work, where foo is a variable of polymorphic type.

Reported by: pabuhr Owned by:
Priority: major Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

sizeof(foo) does not work, where foo is a variable of polymorphic type.
Uses sizeof(void*) instead, since foo is represented as one.

forall(otype T)
void print_sizealign(T dummy) {
    printf("size:%lu, align:%lu\n", sizeof(T), __alignof(T)); // correct
    printf("size:%lu, align:%lu\n", sizeof(dummy), __alignof(dummy)); // fails (unless T has same size/align as void*)
}

Change History (1)

comment:1 Changed 7 years ago by a3moss

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.