Commit 82be290b by Jason Merrill Committed by Jason Merrill

PR c++/83942 - wrong unused warning with static_cast.

	* cvt.c (ocp_convert): Call mark_rvalue_use.

From-SVN: r257155
parent b9921bf0
2018-01-29 Jason Merrill <jason@redhat.com>
PR c++/83942 - wrong unused warning with static_cast.
* cvt.c (ocp_convert): Call mark_rvalue_use.
2018-01-26 Jason Merrill <jason@redhat.com> 2018-01-26 Jason Merrill <jason@redhat.com>
PR c++/83956 - wrong dtor error with anonymous union PR c++/83956 - wrong dtor error with anonymous union
......
...@@ -691,7 +691,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags, ...@@ -691,7 +691,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
/* FIXME remove when moving to c_fully_fold model. */ /* FIXME remove when moving to c_fully_fold model. */
if (!CLASS_TYPE_P (type)) if (!CLASS_TYPE_P (type))
e = scalar_constant_value (e); {
e = mark_rvalue_use (e);
e = scalar_constant_value (e);
}
if (error_operand_p (e)) if (error_operand_p (e))
return error_mark_node; return error_mark_node;
......
// PR c++/83942
// { dg-do compile { target c++11 } }
// { dg-additional-options "-Wall" }
enum class E { E1 };
int main() {
E const e = E::E1;
return static_cast<int>(e);
}
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