Commit f3255019 by Jason Merrill Committed by Jason Merrill

typeck2.c (cxx_incomplete_type_diagnostic): Use the location of value.

	* typeck2.c (cxx_incomplete_type_diagnostic): Use the location of
	value.

From-SVN: r232437
parent 56233bd6
2016-01-15 Jason Merrill <jason@redhat.com> 2016-01-15 Jason Merrill <jason@redhat.com>
* typeck2.c (cxx_incomplete_type_diagnostic): Use the location of
value.
PR c++/69257 PR c++/69257
* typeck.c (decay_conversion): Don't call mark_rvalue_use for * typeck.c (decay_conversion): Don't call mark_rvalue_use for
array/function-to-pointer conversion. Call array/function-to-pointer conversion. Call
......
...@@ -475,13 +475,15 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, ...@@ -475,13 +475,15 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
retry: retry:
/* We must print an error message. Be clever about what it says. */ /* We must print an error message. Be clever about what it says. */
location_t loc = EXPR_LOC_OR_LOC (value, input_location);
switch (TREE_CODE (type)) switch (TREE_CODE (type))
{ {
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
if (!is_decl) if (!is_decl)
complained = emit_diagnostic (diag_kind, input_location, 0, complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of incomplete type %q#T", "invalid use of incomplete type %q#T",
type); type);
if (complained) if (complained)
...@@ -489,7 +491,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, ...@@ -489,7 +491,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
break; break;
case VOID_TYPE: case VOID_TYPE:
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of %qT", type); "invalid use of %qT", type);
break; break;
...@@ -499,7 +501,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, ...@@ -499,7 +501,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
type = TREE_TYPE (type); type = TREE_TYPE (type);
goto retry; goto retry;
} }
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of array with unspecified bounds"); "invalid use of array with unspecified bounds");
break; break;
...@@ -511,11 +513,11 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, ...@@ -511,11 +513,11 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
member = get_first_fn (member); member = get_first_fn (member);
if (DECL_FUNCTION_MEMBER_P (member) if (DECL_FUNCTION_MEMBER_P (member)
&& ! flag_ms_extensions) && ! flag_ms_extensions)
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of member function %qD " "invalid use of member function %qD "
"(did you forget the %<()%> ?)", member); "(did you forget the %<()%> ?)", member);
else else
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of member %qD " "invalid use of member %qD "
"(did you forget the %<&%> ?)", member); "(did you forget the %<&%> ?)", member);
} }
...@@ -523,28 +525,28 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, ...@@ -523,28 +525,28 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
case TEMPLATE_TYPE_PARM: case TEMPLATE_TYPE_PARM:
if (is_auto (type)) if (is_auto (type))
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of %<auto%>"); "invalid use of %<auto%>");
else else
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of template type parameter %qT", type); "invalid use of template type parameter %qT", type);
break; break;
case BOUND_TEMPLATE_TEMPLATE_PARM: case BOUND_TEMPLATE_TEMPLATE_PARM:
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of template template parameter %qT", "invalid use of template template parameter %qT",
TYPE_NAME (type)); TYPE_NAME (type));
break; break;
case TYPENAME_TYPE: case TYPENAME_TYPE:
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of dependent type %qT", type); "invalid use of dependent type %qT", type);
break; break;
case LANG_TYPE: case LANG_TYPE:
if (type == init_list_type_node) if (type == init_list_type_node)
{ {
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"invalid use of brace-enclosed initializer list"); "invalid use of brace-enclosed initializer list");
break; break;
} }
...@@ -552,14 +554,14 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, ...@@ -552,14 +554,14 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
if (value && TREE_CODE (value) == COMPONENT_REF) if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member; goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR) else if (value && TREE_CODE (value) == ADDR_EXPR)
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"address of overloaded function with no contextual " "address of overloaded function with no contextual "
"type information"); "type information");
else if (value && TREE_CODE (value) == OVERLOAD) else if (value && TREE_CODE (value) == OVERLOAD)
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"overloaded function with no contextual type information"); "overloaded function with no contextual type information");
else else
emit_diagnostic (diag_kind, input_location, 0, emit_diagnostic (diag_kind, loc, 0,
"insufficient contextual information to determine type"); "insufficient contextual information to determine type");
break; break;
......
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