public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2003-03-06  0:45 jason
  0 siblings, 0 replies; 7+ messages in thread
From: jason @ 2003-03-06  0:45 UTC (permalink / raw)
  To: andrew, gcc-bugs, gcc-prs, jason

Synopsis: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator

State-Changed-From-To: analyzed->closed
State-Changed-By: jason
State-Changed-When: Thu Mar  6 00:45:06 2003
State-Changed-Why:
    fixed

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9440


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

* Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2003-03-04 23:46 jason
  0 siblings, 0 replies; 7+ messages in thread
From: jason @ 2003-03-04 23:46 UTC (permalink / raw)
  To: andrew, gcc-bugs, gcc-prs, jason, nobody

Synopsis: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator

Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-By: jason
Responsible-Changed-When: Tue Mar  4 23:46:42 2003
Responsible-Changed-Why:
    mine

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9440


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

* Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2003-02-15 18:16 Craig Rodrigues
  0 siblings, 0 replies; 7+ messages in thread
From: Craig Rodrigues @ 2003-02-15 18:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9440; it has been noted by GNATS.

From: Craig Rodrigues <rodrigc@attbi.com>
To: gcc@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   andrew@andypo.net, jason@redhat.com, gcc-gnats@gcc.gnu.org
Subject: Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
Date: Sat, 8 Feb 2003 14:31:51 -0500

 Hi,
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9440 
 
 
 PR 9440 seems to start occurring after this patch on mainline:
 
 2003-01-17  Jason Merrill  <jason@redhat.com>
 
         PR c++/9342
         * call.c (build_conditional_expr): Always do lvalue-rvalue
         conversion.
 
 -- 
 Craig Rodrigues        
 http://home.attbi.com/~rodrigc
 rodrigc@attbi.com


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

* Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2003-01-28 18:26 Andrew Pollard
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Pollard @ 2003-01-28 18:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9440; it has been noted by GNATS.

From: Andrew Pollard <andrewp@andypo.net>
To: bangerth@dealii.org, andrew@andypo.net, gcc-bugs@gcc.gnu.org,
   gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
Date: Tue, 28 Jan 2003 18:16:44 GMT

 bangerth@dealii.org replied:
 
 >    Confirmed. The problem is the lack of a copy constructor,
 >    but the message is profoundly unhelpful in detecting this.
 
 I don't think a copy constructor should have anything to do with it.
 Doesn't the compiler synthesize a copy constructor if there isn't
 one defined?
 
 Anyway, even if I add one, I still get the error...
 
 odd.cxx:
 --------------
 struct A {
     explicit A(int = 0);
     A(const A&);
     operator int() const;
 };
 
 A
 bar(bool b, const A& a)
 {
     return (b ? A() : a);
 }
 --------------
 
 % g++34 -c odd.cxx
 odd.cxx: In function `A bar(bool, const A&)':
 odd.cxx:10: error: non-lvalue in unary `&'
 
 Andrew.


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

* Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2003-01-28 15:41 bangerth
  0 siblings, 0 replies; 7+ messages in thread
From: bangerth @ 2003-01-28 15:41 UTC (permalink / raw)
  To: andrew, gcc-bugs, gcc-prs, nobody

Synopsis: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Jan 28 15:41:17 2003
State-Changed-Why:
    Confirmed. The problem is the lack of a copy constructor,
    but the message is profoundly unhelpful in detecting this.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9440


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

* Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2003-01-25 18:56 Andrew Pollard
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Pollard @ 2003-01-25 18:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9440; it has been noted by GNATS.

From: Andrew Pollard <Andrew.Pollard@brooks-pri.com>
To: gcc-gnats@gcc.gnu.org,  gcc-bugs@gcc.gnu.org,  gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c++/9440: [3.4 regression] error message about "non-lvalue in
 unary '&'" when using ?: operator
Date: Sat, 25 Jan 2003 18:50:39 +0000

 Here's a simplified test case...
 
 struct A {
      explicit A(int = 0);
      operator int() const;
 };
 
 A
 bar(bool b, const A& a)
 {
      return (b ? A() : a);
 }
 
 Andrew.
 


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

* c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2003-01-25 17:56 andrew
  0 siblings, 0 replies; 7+ messages in thread
From: andrew @ 2003-01-25 17:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9440
>Category:       c++
>Synopsis:       [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 25 17:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Pollard
>Release:        gcc-3.4-20030125
>Organization:
>Environment:
i686-pc-linux-gnu RedHat8.0/PIII
>Description:
I'm not 100% convinced that the following bit of code is well formed, but the error message given is rather confusing (what unary '&' :-)

odd.cxx:
----------------
struct A {
    explicit A(int);
    operator int() const;
    friend A operator+(const A&, const A&);
};

A
bar(bool b, const A& a)
{
    return (b ? (A(1) + a) : a);
}
----------------

% g++34 -c odd.cxx
odd.cxx: In function `A bar(bool, const A&)':
odd.cxx:10: error: non-lvalue in unary `&'

Previous versions of gcc (from gcc-3.4-20030108 and below) compile this fine without any modifications.

If either of

a) remove the implicit 'int()' cast
b) return type of 'operator+' is changed to 'A&'

It also compiles fine.
>How-To-Repeat:

>Fix:
Workaround is not to use the ?: operator, but just

    if (b) {
        return (A(1) + a);
    }
    return (a);
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-03-06  0:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-06  0:45 c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator jason
  -- strict thread matches above, loose matches on Subject: below --
2003-03-04 23:46 jason
2003-02-15 18:16 Craig Rodrigues
2003-01-28 18:26 Andrew Pollard
2003-01-28 15:41 bangerth
2003-01-25 18:56 Andrew Pollard
2003-01-25 17:56 andrew

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).