Commit 759deff3 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/55643 ([C++11] incorrect "warning: variable ‘myVar’ set but not used"…

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
parent 597f805e
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:
......
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>
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment