Commit 7fd7263d by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/44682 (warning: variable ‘x’ set but not used)

	PR c++/44682
	* class.c (build_base_path): If want_pointer, call mark_rvalue_use
	on expr.

	* g++.dg/warn/Wunused-var-14.C: New test.

From-SVN: r161511
parent 83377c6a
2010-06-28 Jakub Jelinek <jakub@redhat.com>
PR c++/44682
* class.c (build_base_path): If want_pointer, call mark_rvalue_use
on expr.
2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
* init.c: Do not include except.h.
......
......@@ -283,6 +283,8 @@ build_base_path (enum tree_code code,
if (!want_pointer)
/* This must happen before the call to save_expr. */
expr = cp_build_unary_op (ADDR_EXPR, expr, 0, tf_warning_or_error);
else
mark_rvalue_use (expr);
offset = BINFO_OFFSET (binfo);
fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
......
2010-06-28 Jakub Jelinek <jakub@redhat.com>
PR c++/44682
* g++.dg/warn/Wunused-var-14.C: New test.
2010-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/43298
......
// PR c++/44682
// { dg-do compile }
// { dg-options "-Wunused" }
struct S { virtual ~S () {} };
struct T { virtual ~T () {} };
struct U : S, T {};
void f (U &);
void
g (void *v)
{
T *t = static_cast <T *> (v);
U *u = static_cast <U *> (t);
f (*u);
}
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