This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Call to constructor not recognized as lvalue in function call
- From: David Judson <djudson at houston dot westerngeco dot slb dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 12 Jul 2002 10:08:51 -0500
- Subject: 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++.