@@ -5754,7 +5754,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
&& TREE_CODE (type) == ENUMERAL_TYPE
&& TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type))
{
- WARN_FOR_ASSIGNMENT (input_location, OPT_Wc___compat,
+ WARN_FOR_ASSIGNMENT (location, OPT_Wc___compat,
G_("enum conversion when passing argument "
"%d of %qE is invalid in C++"),
G_("enum conversion in assignment is "
@@ -0,0 +1,12 @@
+/* PR c/61162 */
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+
+enum e { A };
+enum e
+fn1 (void)
+{
+ enum e e, q = 0; /* { dg-warning "17:enum conversion in initialization is invalid" } */
+ e = 0; /* { dg-warning "5:enum conversion in assignment is invalid" } */
+ 1; return 0; /* { dg-warning "6:enum conversion in return is invalid" } */
+}