Opened 6 years ago
Closed 5 years ago
#171 closed defect (duplicate)
0p not working at global scope
| Reported by: | pabuhr | Owned by: | |
|---|---|---|---|
| Priority: | minor | Component: | cfa-cc |
| Version: | 1.0 | Keywords: | |
| Cc: |
Description
Using 0p at global scope fails but works at local scope. 0 works at global scope.
void * realloc( void * ptr, size_t size ) { printf( "fred\n" ); } // C realloc
forall( dtype T | sized(T) )
T * realloc( T * ptr, size_t size ) {
return (T *)(void *)realloc( (void *)ptr, size ); // call C realloc
}
// realloc with 0 pointer => malloc
void * r = realloc( 0p, 4 ); // works with 0, fails with 0p
int main() {
void * r = realloc( 0p, 4 ); // works
}
CFA Version 1.0.0 (debug)
test.cfa: In function '__global_init__':
test.cfa:8:83: error: '_sizeof_Y9_75_51_DT' undeclared (first use in this function)
8 | void * r = realloc( 0p, 4 ); // works with 0, fails with 0p
| ^
test.cfa:8:83: note: each undeclared identifier is reported only once for each function it appears in
test.cfa:8:104: error: '_alignof_Y9_75_51_DT' undeclared (first use in this function)
8 | void * r = realloc( 0p, 4 ); // works with 0, fails with 0p
| ^
Change History (2)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Appears to be the same as #160.