Opened 8 years ago
Closed 8 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*)
}
Note:
See TracTickets
for help on using tickets.