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]

Call to constructor not recognized as lvalue in function call


The following fails to compile with g++ (2.96, 3.0.4 , 3.1)

class T{}
{
public:
T(){}
~T(){}
};

void fxn(T&);

void x()
{
fxn(T()); // error : cannot convert T() to T&
}

However, in another context, T() is recognized as an lvalue.

void y()
{
T aT;
T() = aT;
}

Since this code all compiles with Solaris (Forte), Intel and Microsoft C++ compilers, I'm assume that it's legal C++.


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