Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Dominick Samperi
Mon, 21 Aug 1989 02:05
g++ bug
Author: Dominick Samperi
Date: Mon, 21 Aug 1989 02:05
Date: Mon, 21 Aug 1989 02:05
47 lines
1274 bytes
1274 bytes
The C++ program below illustrate a g++ bug. The function getx() is called
twice, once when x.f() is invoked. When compiled under Zortek C++ getx() is
called only once, as I would expect.
Please let me know if this is a known problem, to be fixed, etc. Thanks!
Dominick Samperi
Citicorp, NAIB
uunet!naib!samperi
/*
* g++bug.c -- Illustrates a g++ bug. The function getx() below is called
* twice, once incorrectly when x.f() is executed.
*
* Dominick Samperi, Citicorp, NAIB
* uunet!naib!samperi
*/
#include <stream.h>
class xclass {
public:
void f() {cout << "(xclass.f)\n";}
};
xclass&
getx() {
xclass& q = *(new xclass);
cout << "(getx)\n";
return q;
}
main () {
xclass& x = getx();
x.f();
/*
* Output is:
*
* (getx)
* (getx)
* (xclass.f)
*
* Looks like getx() is being called again when x.f() is executed.
*/
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads