[gnu.g++.bug] More permissive g++ behavior

schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (11/01/88)

Hi,

   Here is another case of const perversion that g++ should probably
complain about: 

----------------------------------------
#include <stream.h>

int * Foo ( const int *p ) {
   return ( p );  // attempt to circumvent the const qualifier
}   

main (int, char *argv[]) {
   int  i = atoi ( argv [ 1 ] );
   const int *p = &i;
   *( Foo ( p ) ) = 10;
   cout << *p << "\n";
}
----------------------------------------

cfront 1.2.1 prints out:

----------------------------------------
CC  test.C:
"test.C", line 4: error: bad return value type for Foo(): const int * ( int * expected)
1 error
----------------------------------------


Doug
----------
schmidt@bonnie.ics.uci.edu (ARPA) | Quis costodiet ipsos custodes?