diff options
author | lcwu <lcwu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-20 21:13:08 +0000 |
---|---|---|
committer | lcwu <lcwu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-20 21:13:08 +0000 |
commit | b6879aae811621ff7758ccce1acf23f04f02e8bb (patch) | |
tree | 7d0125e6f6b8ac5da38604c980e416aa7193ee02 | |
parent | 62f026a2e86f93e96499dfc147a265d5c4b7dc43 (diff) | |
download | gcc-b6879aae811621ff7758ccce1acf23f04f02e8bb.tar.gz |
PR c++/39803
* gcc/cp/init.c (build_vec_init): Set TREE_NO_WARNING on the
compiler-generated INDIRECT_REF expression.
* gcc/testsuite/g++.dg/warn/Wunused-14.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146454 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/init.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wunused-14.C | 14 |
4 files changed, 27 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0d014f57a17..15f83d9fb88 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2009-04-20 Le-Chun Wu <lcwu@google.com> + + PR c++/39803 + * init.c (build_vec_init): Set TREE_NO_WARNING on the + compiler-generated INDIRECT_REF expression. + 2009-04-20 Ian Lance Taylor <iant@google.com> * typeck.c (build_function_call_vec): New function. @@ -34,7 +40,7 @@ * cp-tree.h (enum tsubst_flags): Rename from enum tsubst_flags_t. (tsubst_flags_t): Change typedef from enum type to int. -2009-04-16 Le-Chun Wu <lcwu@google.com> +2009-04-16 Paolo Bonzini <bonzini@gnu.org> * decl.c (check_initializer): Use TYPE_VECTOR_OPAQUE instead of targetm.vector_opaque_p. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 812042d7f7f..d40a5e7e53f 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2920,6 +2920,7 @@ build_vec_init (tree base, tree maxindex, tree init, atype = build_pointer_type (atype); stmt_expr = build1 (NOP_EXPR, atype, stmt_expr); stmt_expr = cp_build_indirect_ref (stmt_expr, NULL, complain); + TREE_NO_WARNING (stmt_expr) = 1; } current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 478e8936812..c58967338c1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-04-20 Le-Chun Wu <lcwu@google.com> + + PR c++/39803 + * g++.dg/warn/Wunused-14.C: New test. + 2009-04-20 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/specs/small_alignment.ads: New test. diff --git a/gcc/testsuite/g++.dg/warn/Wunused-14.C b/gcc/testsuite/g++.dg/warn/Wunused-14.C new file mode 100644 index 00000000000..b325ccb71dd --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-14.C @@ -0,0 +1,14 @@ +// Test that -Wunused should not emit a warning on the initialization of +// non-POD arrays. See PR c++/39803. +// { dg-do compile } +// { dg-options "-Wunused" } + +#include <utility> + +using std::pair; + +int foo() { + pair<int, const char*> components[3]; // { dg-bogus "value computed is not used" } + components[0].first = 0; + return 0; +} |