🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1515

More permissive g++ behavior

#1515
From: "Douglas C. Schmidt"
Date: Tue, 01 Nov 1988 01:26
33 lines
1189 bytes
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?
Technical Details
Message-ID: <8810311726.aa09601@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu
From: schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: More permissive g++ behavior
Message-ID: <8810311726.aa09601@PARIS.ICS.UCI.EDU>
Date: 1 Nov 88 01:26:27 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 33