gcc bug ?
LOOK, Peter
LookP@rba.gov.au
Sun Nov 12 16:49:00 GMT 2000
Hi,
Enclosed please find a simple program eg3_2_1.cpp which is an example in
P.96 of "Teach Yourself C++" 3rd Edition by Herbert Schildt.
I mis-type the line #18 as
int a(10), b(2);
It should be
samp a(10), b(2);
But, I use gcc to compile. It WORKS, no complaint. When I run the execution
file. It works fine. It should be failed to compile because wrong type
matching !! Is it a bug ?
#include <iostream>
using namespace std;
class samp {
int i;
public:
samp(int n) { i = n; }
int get_i() { return i; }
};
int sqr_it(samp ob)
{
return ob.get_i() * ob.get_i();
}
int main()
{
int a(10), b(2);
cout << sqr_it(a) << "\n";
cout << sqr_it(b) << "\n";
return 0;
}
my gcc version is :
Reading specs from
/usr/local/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.60/sp
ecs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
Also, the compiling option is simple :
gcc -lstdc++ eg3_2_1.cpp -o eg3_2_1.exe
Best Regards,
Peter Look,
System & Technology Dept,
Reserve Bank of Australia.
65 Martin Place, Sydney 2000
Phone : 02-9551-9535
Fax #: 02-9551-8008
Email : lookp@rba.gov.au
**********************************************************************
This e-mail message (along with any attachments) is intended only for
the named addressee and may contain information that is confidential
or privileged. If you are not the intended recipient you are hereby
notified that any dissemination, copying or use of any of the
information is prohibited. If you have received this e-mail message
in error, please notify us immediately by return e-mail and delete all
copies of the original message and attachments.
**********************************************************************
*** This E-Mail has been checked for viruses ***
More information about the Gcc-bugs
mailing list