re PR c++/55643 ([C++11] incorrect "warning: variable ‘myVar’ set but not used" with an "enum class"-typed variable is casted to double for the use)
PR c++/55643 * expr.c (mark_exp_read): Handle FLOAT_EXPR similarly to NOP_EXPR. * g++.dg/warn/Wunused-var-19.C: New test. From-SVN: r194415
This commit is contained in:
parent
597f805e11
commit
759deff3ac
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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>
|
||||
|
26
gcc/testsuite/g++.dg/warn/Wunused-var-19.C
Normal file
26
gcc/testsuite/g++.dg/warn/Wunused-var-19.C
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user