Opened 8 years ago
Closed 8 years ago
#51 closed defect (fixed)
Reference assignment allows pointer conversions
| Reported by: | Rob Schluntz | Owned by: | Rob Schluntz |
|---|---|---|---|
| Priority: | major | Component: | cfa-cc |
| Version: | 1.0 | Keywords: | |
| Cc: |
Description
forall( dtype T | sized(T) ) T * foo( void ) {
printf( "foo1\n" );
return (T *)0;
}
forall( dtype T | sized(T) ) T & foo( void ) {
printf( "foo2\n" );
return (T &)*(T *)0;
}
int main( void ) {
int * i = foo(); // correctly calls foo1
int & j = foo(); // correctly calls foo2
i = foo(); // incorrectly calls foo2 instead of foo1
printf( "fred\n" ); // never gets here
&j = foo(); // correctly calls foo2
}
The call i = foo() incorrectly attempts to convert i to void *.
Note:
See TracTickets
for help on using tickets.
In cdbfab0: