public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: snyder@fnal.gov
To: gcc-gnats@gcc.gnu.org
Subject: c++/9824: weird non-lvalue error with ?: operator
Date: Mon, 24 Feb 2003 08:26:00 -0000	[thread overview]
Message-ID: <200302240818.h1O8I6s13385@localhost.localdomain> (raw)


>Number:         9824
>Category:       c++
>Synopsis:       weird non-lvalue error with ?: operator
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 08:26:02 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        3.4 20030224 (experimental)
>Organization:
>Environment:
System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long : (reconfigured) 
>Description:

g++ gives errors when compiling the source below:

[sss@karma gcc]$ g++ -c x.cc
x.cc: In function `void xxx(int)':
x.cc:17: error: non-lvalue in unary `&'
x.cc:17: error: non-lvalue in unary `&'
x.cc:17: error: non-lvalue in unary `&'
x.cc:17: error: non-lvalue in unary `&'
x.cc:17: error: non-lvalue in unary `&'
$

As far as i can tell, the code is valid --- in any case, the error
is not very helpful, since the code nowhere uses the unary `&' operator
that the message is complaining about.

Rewriting the ternary operator as an if-else makes the error go away,
as does removing the ACE_Time_Value constructor declarations (all of them).

>How-To-Repeat:

---------------------------------------
struct timespec;
struct timeval;

struct ACE_Time_Value
{
  static const ACE_Time_Value max_time;
  ACE_Time_Value (long sec, long usec = 0);
  ACE_Time_Value (const timeval &t);
  ACE_Time_Value (const timespec &t);
  operator timespec () const;
};

static ACE_Time_Value foo (void);

void xxx (int x)
{
  x ? foo () : ACE_Time_Value::max_time;
}
---------------------------------------

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-02-24  8:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-24  8:26 snyder [this message]
2003-02-24  9:56 steven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200302240818.h1O8I6s13385@localhost.localdomain \
    --to=snyder@fnal.gov \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).