public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator
@ 2004-11-13 18:44 reichelt at gcc dot gnu dot org
  2004-11-13 18:51 ` [Bug c++/18464] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-13 18:44 UTC (permalink / raw)
  To: gcc-bugs

The following code is rejected since gcc 3.4.0:

============================================================
struct A
{
    A(int);
    operator void*() const;
};

template<int> void foo(const A& x) { 0 ? x : (x ? x : 0); }
============================================================

bug.cc: In function `void foo(const A&)':
bug.cc:7: error: non-lvalue in unary `&'
bug.cc:7: error: could not convert `x' to `bool'

The code compiles, if I make foo an ordinary (non-template) function.
The problem is similar to PR 9440. (This is in fact a reduced version
of comment #12, but I moved it here, because the original bug in PR9440
has been fixed already.)

-- 
           Summary: [3.4/4.0 regression] error message about "non-lvalue in
                    unary '&'" when using ?: operator
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: rejects-valid, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,lpadovan at cs dot unibo
                    dot it


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


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

* [Bug c++/18464] [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator
  2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
@ 2004-11-13 18:51 ` pinskia at gcc dot gnu dot org
  2004-11-13 19:03 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-13 18:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-13 18:51 -------
: Search converges between 2003-08-19-trunk (#328) and 2003-08-20-trunk (#329).

Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.4.0 4.0.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-13 18:51:51
               date|                            |
   Target Milestone|---                         |3.4.4


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


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

* [Bug c++/18464] [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator
  2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
  2004-11-13 18:51 ` [Bug c++/18464] " pinskia at gcc dot gnu dot org
@ 2004-11-13 19:03 ` reichelt at gcc dot gnu dot org
  2004-12-22  4:39 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-13 19:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-11-13 19:03 -------
Nathan, your patch
http://gcc.gnu.org/ml/gcc-cvs/2003-08/msg00634.html
introduced the regression.

Could you please have a look?
\x13

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/18464] [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator
  2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
  2004-11-13 18:51 ` [Bug c++/18464] " pinskia at gcc dot gnu dot org
  2004-11-13 19:03 ` reichelt at gcc dot gnu dot org
@ 2004-12-22  4:39 ` mmitchel at gcc dot gnu dot org
  2004-12-22 18:01 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-12-22  4:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-12-22 04:39 -------
Working on a fix.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/18464] [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator
  2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-12-22  4:39 ` mmitchel at gcc dot gnu dot org
@ 2004-12-22 18:01 ` cvs-commit at gcc dot gnu dot org
  2004-12-22 18:05 ` [Bug c++/18464] [3.4 " mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-22 18:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-22 18:01 -------
Subject: Bug 18464

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-12-22 18:00:41

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog call.c cp-gimplify.c cvt.c rtti.c 
	                 typeck.c 
Added files:
	gcc/testsuite/g++.dg/template: cond5.C 
	gcc/testsuite/g++.dg/inherit: thunk3.C 
	gcc/testsuite/g++.dg/warn: Wunused-9.C 

Log message:
	PR c++/18464
	* call.c (build_this): In templates, do not bother with
	build_unary_op.
	* typeck.c (unary_complex_lvalue): In a template, always refuse
	simplifications.
	
	PR c++/18492
	* cp-gimplify.c (cp_genericize): Relax assertion.
	
	PR c++/11224
	* cvt.c (convert_to_void): Warn about unused values.
	
	PR c++/18257
	* rtti.c (emit_support_tinfos): On systems without weak symbols,
	emit the runtime library type-info objects as non-COMDAT.
	
	PR c++/18464
	* g++.dg/template/cond5.C: New test.
	
	PR c++/18492
	* g++.dg/inherit/thunk3.C: New test.
	
	PR c++/11224
	* g++.dg/warn/Wunused-9.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4799&r2=1.4800
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/cond5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/thunk3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Wunused-9.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4551&r2=1.4552
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.524&r2=1.525
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-gimplify.c.diff?cvsroot=gcc&r1=1.16&r2=1.17
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cvt.c.diff?cvsroot=gcc&r1=1.174&r2=1.175
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&r1=1.205&r2=1.206
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.605&r2=1.606



-- 


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


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

* [Bug c++/18464] [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
  2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-12-22 18:01 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-22 18:05 ` mmitchel at gcc dot gnu dot org
  2005-05-01 23:26 ` cvs-commit at gcc dot gnu dot org
  2005-05-01 23:29 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-12-22 18:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-12-22 18:05 -------
Fixed in G++ 4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4/4.0 regression] error  |[3.4 regression] error
                   |message about "non-lvalue in|message about "non-lvalue in
                   |unary '&'" when using ?:    |unary '&'" when using ?:
                   |operator                    |operator


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


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

* [Bug c++/18464] [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
  2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-12-22 18:05 ` [Bug c++/18464] [3.4 " mmitchel at gcc dot gnu dot org
@ 2005-05-01 23:26 ` cvs-commit at gcc dot gnu dot org
  2005-05-01 23:29 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-01 23:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-01 23:26 -------
Subject: Bug 18464

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2005-05-01 23:26:26

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog call.c typeck.c 
Added files:
	gcc/testsuite/g++.dg/template: cond5.C 

Log message:
	PR c++/18464
	* call.c (build_this): In templates, do not bother with
	build_unary_op.
	* typeck.c (unary_complex_lvalue): In a template, always refuse
	simplifications.
	
	PR c++/18464
	* g++.dg/template/cond5.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.385&r2=1.3389.2.386
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/cond5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.34.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.213&r2=1.3892.2.214
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.25&r2=1.452.2.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.519.2.25&r2=1.519.2.26



-- 


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


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

* [Bug c++/18464] [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
  2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-05-01 23:26 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-01 23:29 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-01 23:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-05-01 23:29 -------
Fixed in GCC 3.4.4.

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


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


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

end of thread, other threads:[~2005-05-01 23:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-13 18:44 [Bug c++/18464] New: [3.4/4.0 regression] error message about "non-lvalue in unary '&'" when using ?: operator reichelt at gcc dot gnu dot org
2004-11-13 18:51 ` [Bug c++/18464] " pinskia at gcc dot gnu dot org
2004-11-13 19:03 ` reichelt at gcc dot gnu dot org
2004-12-22  4:39 ` mmitchel at gcc dot gnu dot org
2004-12-22 18:01 ` cvs-commit at gcc dot gnu dot org
2004-12-22 18:05 ` [Bug c++/18464] [3.4 " mmitchel at gcc dot gnu dot org
2005-05-01 23:26 ` cvs-commit at gcc dot gnu dot org
2005-05-01 23:29 ` mmitchel 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).