summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-11 19:01:45 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-11 19:01:45 +0000
commitc8749fa873ad916468351397d7189b75c1341701 (patch)
treecd397745f2b22d3b1c055b04416813a614eb5f4d
parentd7d5549c3dd2aae5f664758f8a346a87bcd386e6 (diff)
downloadppe42-gcc-c8749fa873ad916468351397d7189b75c1341701.tar.gz
ppe42-gcc-c8749fa873ad916468351397d7189b75c1341701.zip
PR c++/55643
* expr.c (mark_exp_read): Handle FLOAT_EXPR similarly to NOP_EXPR. * g++.dg/warn/Wunused-var-19.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194415 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/expr.c1
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-19.C26
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2c3efe82556..2cd295b5b53 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/55643
+ * expr.c (mark_exp_read): Handle FLOAT_EXPR similarly to NOP_EXPR.
+
2012-12-11 Jason Merrill <jason@redhat.com>
PR c++/54416
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index ede4725da2f..c521e7d930f 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -131,6 +131,7 @@ mark_exp_read (tree exp)
CASE_CONVERT:
case ADDR_EXPR:
case INDIRECT_REF:
+ case FLOAT_EXPR:
mark_exp_read (TREE_OPERAND (exp, 0));
break;
case COMPOUND_EXPR:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e6d4f69d4e3..ef71057069e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2012-12-11 Jakub Jelinek <jakub@redhat.com>
+ PR c++/55643
+ * g++.dg/warn/Wunused-var-19.C: New test.
+
* g++.dg/asan/asan_test.C: Link -lasan before -lpthread.
2012-12-11 Eric Botcazou <ebotcazou@adacore.com>
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-19.C b/gcc/testsuite/g++.dg/warn/Wunused-var-19.C
new file mode 100644
index 00000000000..4d26b368143
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-19.C
@@ -0,0 +1,26 @@
+// PR c++/55643
+// { dg-do compile }
+// { dg-options "-std=c++11 -Wunused" }
+
+enum class E { e = 123 };
+
+int
+foo ()
+{
+ E x = E::e;
+ return (double) x;
+}
+
+int
+bar ()
+{
+ E x = E::e;
+ return (long double) x;
+}
+
+int
+baz ()
+{
+ E x = E::e;
+ return (float) x;
+}
OpenPOWER on IntegriCloud