This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Wow!


Hello all!

How about that:
-------------- cut here ------------------------------------------------
#include <iostream>
using namespace std;

int f1()
{
    return 1;
}

int f2(const int n)
{
    cout << n << endl;
    return 2;
}

int main()
{
    int k=0;
    if ((k = f1() == -1) || (f2(k) == -1))
    {
        cout << "Shouldn't be here" << endl;
    } 
}
---------------- cut here ----------------------------------------
What will be printed from f2 with gcc 3.2, gcc 3.3.1?
0!!!!!!!

It is a bug. Isn't it?
 
----
Lev Assinovsky
Aelita Software Corporation
O&S Core Division, Programmer
ICQ# 165072909


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]