public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf
@ 2007-10-01 21:42 mdorey at bluearc dot com
2007-10-03 14:48 ` [Bug c++/33616] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: mdorey at bluearc dot com @ 2007-10-01 21:42 UTC (permalink / raw)
To: gcc-bugs
devadmin@diesel:/tmp$ cat > non-lvalue-pmf.cpp
struct Receive {
};
struct TcpStats {
Receive rx;
};
typedef void (Receive::*StatsGatherer)(void);
template <StatsGatherer gatherStats>
void test(TcpStats* tcpStats) {
(tcpStats->rx.*gatherStats)();
}
devadmin@diesel:/tmp$ g++ -W -Wall -pedantic -g -c -o non-lvalue-pmf.o non-lv
alue-pmf.cpp
non-lvalue-pmf.cpp: In function ?void test(TcpStats*)?:
non-lvalue-pmf.cpp:12: error: lvalue required as unary '&' operand
devadmin@diesel:/tmp$
If this is indeed a bug then it's a regression between 3.3.6 (Debian
1:3.3.6-15) and Debian 4.2.1-5:
devadmin@diesel:/tmp$ g++-3.3 -W -Wall -pedantic -g -c -o non-lvalue-pmf.o
non-lvalue-pmf.cpp
devadmin@diesel:/tmp$
The regression, if that's what it is, was before 4.1.3 20070831 (prerelease)
(Debian 4.1.2-16). The error message was improved between 4.1 and 4.2 but the
same underlying problem is in 4.1.
Various easy and harmless work-arounds are possible, for example, changing the
body of the function to read:
Receive& rx = tcpStats->rx;
(rx.*gatherStats)();
I tried to simplify the example further but I've been unable to. One of the
changes that makes the problem go away is to replace the line:
template <StatsGatherer gatherStats>
With:
StatsGatherer gatherStats;
I don't see why that should affect the "lvalue-ness" of tcpStats->rx but I've
been wrong about such things many times before and I look forward to being
amazed.
Extra parentheses around (tcpStats->rx) don't help, just to save anyone from
looking up the operator precedence tables (which was the first thing I did).
--
Summary: "lvalue required as unary '&' operand" with template pmf
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mdorey at bluearc dot com
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2/4.3 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
@ 2007-10-03 14:48 ` bangerth at dealii dot org
2007-10-03 15:35 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2007-10-03 14:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from bangerth at dealii dot org 2007-10-03 14:48 -------
Confirmed, a regression introduced by the new parser in 3.4.0.
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |rejects-valid
Known to fail| |3.4.0 4.0.4 4.1.0 4.2.0
| |4.3.0
Known to work| |3.3.6
Last reconfirmed|0000-00-00 00:00:00 |2007-10-03 14:48:18
date| |
Summary|"lvalue required as unary |[4.1/4.2/4.3 regression]
|'&' operand" with template |"lvalue required as unary
|pmf |'&' operand" with template
| |pmf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2/4.3 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
2007-10-03 14:48 ` [Bug c++/33616] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
@ 2007-10-03 15:35 ` pinskia at gcc dot gnu dot org
2007-10-07 20:10 ` mmitchel at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-10-03 15:35 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Target Milestone|--- |4.2.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2/4.3 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
2007-10-03 14:48 ` [Bug c++/33616] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
2007-10-03 15:35 ` pinskia at gcc dot gnu dot org
@ 2007-10-07 20:10 ` mmitchel at gcc dot gnu dot org
2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-10-07 20:10 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2/4.3 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (2 preceding siblings ...)
2007-10-07 20:10 ` mmitchel at gcc dot gnu dot org
@ 2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
2007-10-30 11:57 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-10-09 19:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from mmitchel at gcc dot gnu dot org 2007-10-09 19:20 -------
Change target milestone to 4.2.3, as 4.2.2 has been released.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.2 |4.2.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2/4.3 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (3 preceding siblings ...)
2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
@ 2007-10-30 11:57 ` jakub at gcc dot gnu dot org
2007-10-30 22:38 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-10-30 11:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2007-10-30 11:56 -------
Testing:
--- gcc/cp/decl2.c.jj 2007-10-28 19:34:13.000000000 +0100
+++ gcc/cp/decl2.c 2007-10-30 12:52:35.000000000 +0100
@@ -3499,9 +3499,9 @@ build_offset_ref_call_from_tree (tree fn
parameter. That must be done before the FN is transformed
because we depend on the form of FN. */
args = build_non_dependent_args (args);
+ object = build_non_dependent_expr (object);
if (TREE_CODE (fn) == DOTSTAR_EXPR)
object = build_unary_op (ADDR_EXPR, object, 0);
- object = build_non_dependent_expr (object);
args = tree_cons (NULL_TREE, object, args);
/* Now that the arguments are done, transform FN. */
fn = build_non_dependent_expr (fn);
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-10-03 14:48:18 |2007-10-30 11:56:54
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2/4.3 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (4 preceding siblings ...)
2007-10-30 11:57 ` jakub at gcc dot gnu dot org
@ 2007-10-30 22:38 ` jakub at gcc dot gnu dot org
2007-10-30 22:42 ` [Bug c++/33616] [4.1/4.2 " jakub at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-10-30 22:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2007-10-30 22:38 -------
Subject: Bug 33616
Author: jakub
Date: Tue Oct 30 22:37:53 2007
New Revision: 129784
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129784
Log:
PR c++/33616
* decl2.c (build_offset_ref_call_from_tree): Call
build_non_dependent_expr on object prior to building ADDR_EXPR from it
if FN is DOTSTAR_EXPR.
* g++.dg/template/ptrmem18.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/template/ptrmem18.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl2.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (5 preceding siblings ...)
2007-10-30 22:38 ` jakub at gcc dot gnu dot org
@ 2007-10-30 22:42 ` jakub at gcc dot gnu dot org
2008-02-01 17:00 ` jsm28 at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-10-30 22:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2007-10-30 22:41 -------
Fixed so far on the trunk.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|3.4.0 4.0.4 4.1.0 4.2.0 |3.4.0 4.0.4 4.1.0 4.2.0
|4.3.0 |
Known to work|3.3.6 |3.3.6 4.3.0
Summary|[4.1/4.2/4.3 regression] |[4.1/4.2 regression] "lvalue
|"lvalue required as unary |required as unary '&'
|'&' operand" with template |operand" with template pmf
|pmf |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (6 preceding siblings ...)
2007-10-30 22:42 ` [Bug c++/33616] [4.1/4.2 " jakub at gcc dot gnu dot org
@ 2008-02-01 17:00 ` jsm28 at gcc dot gnu dot org
2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-02-01 17:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jsm28 at gcc dot gnu dot org 2008-02-01 16:54 -------
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.3 |4.2.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.1/4.2 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (7 preceding siblings ...)
2008-02-01 17:00 ` jsm28 at gcc dot gnu dot org
@ 2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
2008-07-04 22:51 ` [Bug c++/33616] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 22:29 ` jsm28 at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-05-19 20:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jsm28 at gcc dot gnu dot org 2008-05-19 20:23 -------
4.2.4 is being released, changing milestones to 4.2.5.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.4 |4.2.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.2 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (8 preceding siblings ...)
2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
@ 2008-07-04 22:51 ` jsm28 at gcc dot gnu dot org
2009-03-30 22:29 ` jsm28 at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jsm28 at gcc dot gnu dot org 2008-07-04 22:50 -------
Closing 4.1 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.1/4.2 regression] "lvalue|[4.2 regression] "lvalue
|required as unary '&' |required as unary '&'
|operand" with template pmf |operand" with template pmf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/33616] [4.2 regression] "lvalue required as unary '&' operand" with template pmf
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
` (9 preceding siblings ...)
2008-07-04 22:51 ` [Bug c++/33616] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 22:29 ` jsm28 at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 22:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jsm28 at gcc dot gnu dot org 2009-03-30 22:28 -------
Closing 4.2 branch, fixed in 4.3.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|3.4.0 4.0.4 4.1.0 4.2.0 |3.4.0 4.0.4 4.1.0 4.2.0
| |4.2.5
Resolution| |FIXED
Target Milestone|4.2.5 |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33616
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-03-30 22:29 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-01 21:42 [Bug c++/33616] New: "lvalue required as unary '&' operand" with template pmf mdorey at bluearc dot com
2007-10-03 14:48 ` [Bug c++/33616] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
2007-10-03 15:35 ` pinskia at gcc dot gnu dot org
2007-10-07 20:10 ` mmitchel at gcc dot gnu dot org
2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
2007-10-30 11:57 ` jakub at gcc dot gnu dot org
2007-10-30 22:38 ` jakub at gcc dot gnu dot org
2007-10-30 22:42 ` [Bug c++/33616] [4.1/4.2 " jakub at gcc dot gnu dot org
2008-02-01 17:00 ` jsm28 at gcc dot gnu dot org
2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
2008-07-04 22:51 ` [Bug c++/33616] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 22:29 ` jsm28 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).