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 + + PR c++/55643 + * expr.c (mark_exp_read): Handle FLOAT_EXPR similarly to NOP_EXPR. + 2012-12-11 Jason Merrill 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 + 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 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; +}