[Bug c++/11363] New: Execution order is not correct
qyang at media dot lbl dot gov
gcc-bugzilla@gcc.gnu.org
Sat Jun 28 18:15:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11363
Summary: Execution order is not correct
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: qyang at media dot lbl dot gov
CC: gcc-bugs at gcc dot gnu dot org
The details are included in the comments of the following source file:
------------------------------------------------------------------
/*
File: main.cpp
*/
#include <iostream>
#include <string>
using namespace std;
struct T1 {
string f()
{
cout << "f() called\n";
return string("1");
}
string g()
{
cout << "g() called\n";
return string("2");
}
};
struct T2 {
void add(const string& i, const string &j)
{
}
};
int main()
{
T2 t2;
T1 t1;
/*
Consider the following line.
I expect that t1.f() is called before t1.g().
But the real execution is:
t1.g() is called before t1.f().
I compiled this program by:
g++ main.cpp
Version information:
g++ (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
*/
t2.add(t1.f(), t1.g());
return 0;
}
More information about the Gcc-bugs
mailing list