This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13384] New: error: non-lvalue in assignment - message a little misleading for C++
- From: "gianni at mariani dot ws" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2003 16:36:16 -0000
- Subject: [Bug c++/13384] New: error: non-lvalue in assignment - message a little misleading for C++
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The code below :
struct C
{
int a;
C()
: a(1)
{
}
};
template<typename T> void func()
{
T() = T();
}
int main()
{
func<C>();
func<int>();
}
Produces the error message
"error: non-lvalue in assignment"
As you can see, the first instantiation (func<C>) is quite happy to call assign
on an rvalue. The second (func<int>) uses the built-in operator= which does not
allow assignment to non-lvalue. While the message is accurate, it would be IMHO
better if the message was:
"error: non-lvalue in built-in assignment" (suggestions welcome)
This message geneaology is probably from the C compiler and is a little
misleading for C++.
--
Summary: error: non-lvalue in assignment - message a little
misleading for C++
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gianni at mariani dot ws
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384