public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13384] New: error: non-lvalue in assignment - message a little misleading for C++
@ 2003-12-11 16:36 gianni at mariani dot ws
2003-12-11 17:05 ` [Bug c++/13384] " bangerth at dealii dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: gianni at mariani dot ws @ 2003-12-11 16:36 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
2003-12-11 16:36 [Bug c++/13384] New: error: non-lvalue in assignment - message a little misleading for C++ gianni at mariani dot ws
@ 2003-12-11 17:05 ` bangerth at dealii dot org
2004-03-13 6:43 ` pinskia at gcc dot gnu dot org
2005-01-29 13:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2003-12-11 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2003-12-11 17:05 -------
I can confirm the behavior, though I'm not sure whether we really
need to change the error message. Gaby -- you're the diagnostics
maintainer, so it's your call.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2003-12-11 17:05:26
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
2003-12-11 16:36 [Bug c++/13384] New: error: non-lvalue in assignment - message a little misleading for C++ gianni at mariani dot ws
2003-12-11 17:05 ` [Bug c++/13384] " bangerth at dealii dot org
@ 2004-03-13 6:43 ` pinskia at gcc dot gnu dot org
2005-01-29 13:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-13 6:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-13 06:43 -------
Icc 6.0 produces:
pr13384.cc(15): error: expression must be a modifiable lvalue
T() = T();
^
detected during instantiation of "void func<T>() [with T=int]"
compilation aborted for pr13384.cc (code 2)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
2003-12-11 16:36 [Bug c++/13384] New: error: non-lvalue in assignment - message a little misleading for C++ gianni at mariani dot ws
2003-12-11 17:05 ` [Bug c++/13384] " bangerth at dealii dot org
2004-03-13 6:43 ` pinskia at gcc dot gnu dot org
@ 2005-01-29 13:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-29 13:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-29 13:32 -------
But note C++ has a definition of lvalue and rvalues so the message is still correct in the C++ sense.
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2004-06-13 09:42:53 |2005-01-29 13:32:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-29 13:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-11 16:36 [Bug c++/13384] New: error: non-lvalue in assignment - message a little misleading for C++ gianni at mariani dot ws
2003-12-11 17:05 ` [Bug c++/13384] " bangerth at dealii dot org
2004-03-13 6:43 ` pinskia at gcc dot gnu dot org
2005-01-29 13:32 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).