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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ messages in thread

* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
       [not found] <bug-13384-2828@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-12-05  8:02 ` jakub at gcc dot gnu dot org
@ 2005-12-12 20:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-12 20:12 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
       [not found] <bug-13384-2828@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-12-01 12:01 ` gdr at gcc dot gnu dot org
@ 2005-12-05  8:02 ` jakub at gcc dot gnu dot org
  2005-12-12 20:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-12-05  8:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2005-12-05 08:02 -------
Subject: Bug 13384

Author: jakub
Date: Mon Dec  5 08:02:53 2005
New Revision: 108045

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108045
Log:
        PR c/13384
        * gcc.dg/gomp/atomic-5.c: Adjust.
        * g++.dg/gomp/atomic-5.C: Likewise.

Modified:
    branches/gomp-20050608-branch/gcc/testsuite/ChangeLog.gomp
    branches/gomp-20050608-branch/gcc/testsuite/g++.dg/gomp/atomic-5.C
    branches/gomp-20050608-branch/gcc/testsuite/gcc.dg/gomp/atomic-5.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
       [not found] <bug-13384-2828@http.gcc.gnu.org/bugzilla/>
  2005-11-26  8:57 ` gdr at gcc dot gnu dot org
  2005-12-01 12:00 ` gdr at gcc dot gnu dot org
@ 2005-12-01 12:01 ` gdr at gcc dot gnu dot org
  2005-12-05  8:02 ` jakub at gcc dot gnu dot org
  2005-12-12 20:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-12-01 12:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gdr at gcc dot gnu dot org  2005-12-01 12:01 -------
Fixed in 4.2.x (mainline).


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
       [not found] <bug-13384-2828@http.gcc.gnu.org/bugzilla/>
  2005-11-26  8:57 ` gdr at gcc dot gnu dot org
@ 2005-12-01 12:00 ` gdr at gcc dot gnu dot org
  2005-12-01 12:01 ` gdr at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-12-01 12:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from gdr at gcc dot gnu dot org  2005-12-01 12:00 -------
Subject: Bug 13384

Author: gdr
Date: Thu Dec  1 12:00:17 2005
New Revision: 107816

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107816
Log:
        PR c/13384
        * c-common.c (lvalue_error): Fix wording.
testsuite/
        PR c/13384
        * gcc.dg/pr17730-1.c: Adjust.
        * gcc.dg/lvalue1.c (main): Likewise.
        * gcc.dg/lvalue-2.c: Likewise.
        * g++.dg/pr7503-3.C

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/opt/pr7503-3.C
    trunk/gcc/testsuite/gcc.dg/lvalue-2.c
    trunk/gcc/testsuite/gcc.dg/lvalue1.c
    trunk/gcc/testsuite/gcc.dg/pr17730-1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13384] error: non-lvalue in assignment - message a little misleading for C++
       [not found] <bug-13384-2828@http.gcc.gnu.org/bugzilla/>
@ 2005-11-26  8:57 ` gdr at gcc dot gnu dot org
  2005-12-01 12:00 ` gdr at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-11-26  8:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from gdr at gcc dot gnu dot org  2005-11-26 08:57 -------
(In reply to comment #1)
> 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. 

I believe it is OK to add "built-in" for the purpose of removing
ambiguities.

-- Gaby


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |gdr at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-09-23 22:41:30         |2005-11-26 08:57:41
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13384


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-12 20:12 UTC | newest]

Thread overview: 9+ 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
     [not found] <bug-13384-2828@http.gcc.gnu.org/bugzilla/>
2005-11-26  8:57 ` gdr at gcc dot gnu dot org
2005-12-01 12:00 ` gdr at gcc dot gnu dot org
2005-12-01 12:01 ` gdr at gcc dot gnu dot org
2005-12-05  8:02 ` jakub at gcc dot gnu dot org
2005-12-12 20:12 ` 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).