PR c++/55643
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Dec 2012 19:01:45 +0000 (19:01 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Dec 2012 19:01:45 +0000 (19:01 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wunused-var-19.C [new file with mode: 0644]

index 2c3efe8..2cd295b 100644 (file)
@@ -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
index ede4725..c521e7d 100644 (file)
@@ -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:
index e6d4f69..ef71057 100644 (file)
@@ -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 (file)
index 0000000..4d26b36
--- /dev/null
@@ -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;
+}