Commit 2b107f6b by Marek Polacek Committed by Marek Polacek

re PR c/61162 (possibly bad error location with -Wc++-compat)

	PR c/61162
	* c-typeck.c (convert_for_assignment): Pass location to
	WARN_FOR_ASSIGNMENT instead of input_location.

	* gcc.dg/pr61162.c: New test.

From-SVN: r210393
parent 6052140c
2014-05-13 Marek Polacek <polacek@redhat.com>
PR c/61162
* c-typeck.c (convert_for_assignment): Pass location to
WARN_FOR_ASSIGNMENT instead of input_location.
2014-05-10 Marek Polacek <polacek@redhat.com>
* c-parser.c (c_parser_declaration_or_fndef): Pass init_loc to
......
......@@ -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 "
......
2014-05-13 Marek Polacek <polacek@redhat.com>
PR c/61162
* gcc.dg/pr61162.c: New test.
2014-05-13 Marek Polacek <polacek@redhat.com>
* c-c++-common/pr50459.c: Move cdtor tests to a separate testcase.
* c-c++-common/pr50459-2.c: New test.
......
/* 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" } */
}
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