Commit e8e399c3 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/45588 (unused-but-set-variable false trigger building gold)

	PR c++/45588
	* pt.c (tsubst) <case INTEGER_TYPE>: Call mark_rvalue_use
	before calling fold_decl_constant_value.

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

From-SVN: r164051
parent c8a27c40
2010-09-08 Jakub Jelinek <jakub@redhat.com>
PR c++/45588
* pt.c (tsubst) <case INTEGER_TYPE>: Call mark_rvalue_use
before calling fold_decl_constant_value.
2010-09-07 Arnaud Charlet <charlet@adacore.com> 2010-09-07 Arnaud Charlet <charlet@adacore.com>
* cp-tree.h (build_enumerator): Add new location_t parameter. * cp-tree.h (build_enumerator): Add new location_t parameter.
......
...@@ -10116,6 +10116,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -10116,6 +10116,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
&& !TREE_TYPE (max)) && !TREE_TYPE (max))
TREE_TYPE (max) = TREE_TYPE (TREE_OPERAND (max, 0)); TREE_TYPE (max) = TREE_TYPE (TREE_OPERAND (max, 0));
max = mark_rvalue_use (max);
max = fold_decl_constant_value (max); max = fold_decl_constant_value (max);
/* If we're in a partial instantiation, preserve the magic NOP_EXPR /* If we're in a partial instantiation, preserve the magic NOP_EXPR
......
2010-09-08 Jakub Jelinek <jakub@redhat.com>
PR c++/45588
* g++.dg/warn/Wunused-var-15.C: New test.
2010-09-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2010-09-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* c-c++-common/Wunused-var-12.c: Add -fno-common to options on 32-bit * c-c++-common/Wunused-var-12.c: Add -fno-common to options on 32-bit
......
// PR c++/45588
// { dg-do compile }
// { dg-options "-Wunused" }
void bar (unsigned char *);
template <int N>
struct S
{
static const int k = 6;
};
template <int N>
const int S<N>::k;
template <int N>
void
foo ()
{
const int i = S<N>::k;
unsigned char a[i];
bar (a);
}
void
baz ()
{
foo<0> ();
}
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