sher@rochester.ARPA (David Sher) (09/15/86)
This piece of code generates incorrect C code. The fact that
it is incorrect C++ code is no excuse since it involves a type violation
that cfront should catch (an (int ()) is not an int). We have not yet
recieved or installed the 1.1 C++ (I don't know whether we've got it yet).
The code is thus:
#include <stream.h>
#include <stdio.h>
class foo
{
int cat;
public:
foo( int x , int y ) { cat = x + y; }
const int sile() { return sile; }
};
main()
{
foo x(1,7);
cout << x.sile();
}
--
-David Sher
sher@rochester
{allegra,seismo}!rochester!sherbs@alice.UucP (Bjarne Stroustrup) (09/19/86)
> Subject: Bug in 1.0 compiler > Path: ..!rochester!sher (David Sher @ U of Rochester, CS Dept, Rochester, NY) > This piece of code generates incorrect C code. The fact that > it is incorrect C++ code is no excuse since it involves a type violation > that cfront should catch (an (int ()) is not an int). We have not yet > recieved or installed the 1.1 C++ (I don't know whether we've got it yet). > The code is thus: #include <stream.h> #include <stdio.h> class foo { int cat; public: foo( int x , int y ) { cat = x + y; } const int sile() { return sile; } }; main() { foo x(1,7); cout << x.sile(); } Sorry, fixed in 1.1: "b.c", line 9: error: bad return value type for foo::sile(): const int foo::() ( const int expected)