Article View: gnu.g++.bug
Article #1907Semicolon can be replaced by dummy function!
From: OVE EWERLID
Date: Tue, 25 Apr 1989 23:28
Date: Tue, 25 Apr 1989 23:28
55 lines
1357 bytes
1357 bytes
If this has been reported before, please ignore!
G++ 1.35-, running on a sun3;
Consider:
-+- -+- -+-
class Test
{
protected:
double xx, yy, zz;
public:
Test(doubel, double, double);
} // Semicolon missing!
dummy(){} // This seems to replace the missing semicolon after the class!
inline Test::Test(double x, doubel y, double z)
{
xx=x; yy=y; zz=z;
}
main(){}
-+- -+- -+-
// The above compiles, but should it?
// I think the answer is no as the above is invalid C++!
// Now look at the this:
-+- -+- -+-
class Test
{
protected:
double xx, yy, zz;
public:
Test(doubel, double, double);
}; // The semicolon added
inline Test::Test(double x, doubel y, double z)
{
xx=x; yy=y; zz=z;
}
-+- -+- -+-
// which is the valid C++ code.
// The bug seems to be the fact that one can leave out the semicolon
// after a class definition and replace it with a dummy function.
// I haven't checked, but it may also apply to structs.
Technical Details
Message-ID:
<4929@eva.slu.se>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!kth!draken!bmc1!eva!pelleShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!kth!draken!bmc1!eva!pelle From: pelle@eva.slu.se (OVE EWERLID) Newsgroups: gnu.g++.bug Subject: Semicolon can be replaced by dummy function! Message-ID: <4929@eva.slu.se> Date: 25 Apr 89 23:28:44 GMT Organization: Detron Lines: 55