Article View: gnu.g++.bug
Article #386bug with const class objects.
From: Mike Lijewski
Date: Fri, 01 Sep 1989 19:43
Date: Fri, 01 Sep 1989 19:43
49 lines
1922 bytes
1922 bytes
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
Technical Details
Message-ID:
<8758@batcomputer.tn.cornell.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!lijewskiShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!lijewski From: lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) Newsgroups: gnu.g++.bug Subject: bug with const class objects. Message-ID: <8758@batcomputer.tn.cornell.edu> Date: 1 Sep 89 19:43:49 GMT Organization: Cornell National Supercomputer Facility Lines: 49 Keywords: g++ const