Commit e3ae330d by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/47783 (Warning 'set but not used' [-Wunused-but-set-parameter]…

re PR c++/47783 (Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper)

	PR c++/47783
	* cvt.c (convert_from_reference): Call mark_exp_read.

	* g++.dg/warn/Wunused-parm-4.C: New test.

From-SVN: r170255
parent a855debf
2011-02-17 Jakub Jelinek <jakub@redhat.com>
PR c++/47783
* cvt.c (convert_from_reference): Call mark_exp_read.
2011-02-11 Dodji Seketeli <dodji@redhat.com>
PR c++/47172
......
......@@ -512,6 +512,7 @@ convert_from_reference (tree val)
tree t = TREE_TYPE (TREE_TYPE (val));
tree ref = build1 (INDIRECT_REF, t, val);
mark_exp_read (val);
/* We *must* set TREE_READONLY when dereferencing a pointer to const,
so that we get the proper error message if the result is used
to assign to. Also, &* is supposed to be a no-op. */
......
2011-02-17 Jakub Jelinek <jakub@redhat.com>
PR c++/47783
* g++.dg/warn/Wunused-parm-4.C: New test.
2011-02-17 Alexandre Oliva <aoliva@redhat.com>
Jan Hubicka <jh@suse.cz>
......
// PR c++/47783
// { dg-do compile }
// { dg-options "-Wunused -W" }
struct R
{
int &i;
};
void
foo (R r, int &s)
{
r.i = 7;
s = 8;
}
int
bar ()
{
int x = 1, y = 1;
R r = { x };
foo (r, y);
return x + y;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment