lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) (09/02/89)
The following script illustrates a program with sets a member of a class object which is declared const using a non-const member function. It is my understanding that this should be flagged during compilation as an error. Script started on Fri Sep 1 15:30:37 1989 robbie(1)->cat b.cc class foo{ int x; public: void set(int i) { x = i; } }; main(void) { const foo i; i.set(24); } robbie(2)->g++ -v b.cc g++ version 1.36.0- /usr/local/lib/gcc-cpp -+ -v -I/usr/local/include/g++-include -undef -D__GNU__ -D__GNUG__ -D__GNUC__ -D__cplusplus -Dunix -Di386 -Dsun386 -Dsun -D__unix__ -D__i386__ -D__sun386__ -D__sun__ b.cc /tmp/cca00814.cpp GNU CPP version 1.35.96 /usr/local/lib/gcc-cc1plus /tmp/cca00814.cpp -quiet -dumpbase b.cc -noreg -version -o /tmp/cca00814.s GNU C++ version 1.36.0- (80386, Sun syntax) compiled by GNU C version 1.35.96. default target switches: -m80387 as -i386 /tmp/cca00814.s -o b.o ld -r -o /tmp/cca00814.R -Bstatic /usr/local/lib/crt0+.o b.o /usr/local/lib/libg++.a /usr/local/lib/gcc-gnulib -lc collect -o /tmp/cca00814.S /tmp/cca00814.R as /tmp/cca00814.S -o /tmp/cca00814.O ld -Bstatic -e _start /tmp/cca00814.R /tmp/cca00814.O rm -f /tmp/cca00814.R /tmp/cca00814.O robbie(3)->exit script done on Fri Sep 1 15:31:35 1989 -- Mike Lijewski (H)607/277-7623 (W)607/255-0539 (desk)607/255-2960 Cornell National Supercomputer Facility ARPA: mjlx@cornellf.tn.cornell.edu BITNET: mjlx@cornellf.bitnet SMAIL: 1122 Ellis Hollow Rd. Ithaca, NY 14850
schmidt@zola.ics.uci.edu (Doug Schmidt) (09/02/89)
In article <8758@batcomputer.tn.cornell.edu>, lijewski@batcomputer (Mike Lijewski) writes: > >The following script illustrates a program with sets a member >of a class object which is declared const using a non-const member >function. It is my understanding that this should be flagged >during compilation as an error. > > >Script started on Fri Sep 1 15:30:37 1989 > >robbie(1)->cat b.cc > >class foo{ > int x; > public: > void set(int i) { x = i; } >}; > >main(void) >{ > const foo i; > > i.set(24); >} This is fixed in a later beta release... Doug -- schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente. office: (714) 856-4043 | Per me si va nell'eterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza o voi ch'entrate.