From: Jason Merrill Date: Fri, 15 Jan 2016 15:57:12 +0000 (-0500) Subject: typeck2.c (cxx_incomplete_type_diagnostic): Use the location of value. X-Git-Tag: basepoints/gcc-7~1594 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f32550199459a387e1ece1b385460cb0603cb6d5;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 028088400fcd..fc846dc7e3a6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-01-15 Jason Merrill + * typeck2.c (cxx_incomplete_type_diagnostic): Use the location of + value. + PR c++/69257 * typeck.c (decay_conversion): Don't call mark_rvalue_use for array/function-to-pointer conversion. Call diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index c67d7f6833ed..ac2f3c366e8d 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -475,13 +475,15 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, retry: /* 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)) { case RECORD_TYPE: case UNION_TYPE: case ENUMERAL_TYPE: 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", type); if (complained) @@ -489,7 +491,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, break; case VOID_TYPE: - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "invalid use of %qT", type); break; @@ -499,7 +501,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, type = TREE_TYPE (type); goto retry; } - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "invalid use of array with unspecified bounds"); break; @@ -511,11 +513,11 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, member = get_first_fn (member); if (DECL_FUNCTION_MEMBER_P (member) && ! flag_ms_extensions) - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "invalid use of member function %qD " "(did you forget the %<()%> ?)", member); else - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "invalid use of member %qD " "(did you forget the %<&%> ?)", member); } @@ -523,28 +525,28 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, case TEMPLATE_TYPE_PARM: if (is_auto (type)) - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "invalid use of %"); else - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "invalid use of template type parameter %qT", type); break; 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", TYPE_NAME (type)); break; case TYPENAME_TYPE: - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "invalid use of dependent type %qT", type); break; case LANG_TYPE: 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"); break; } @@ -552,14 +554,14 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, if (value && TREE_CODE (value) == COMPONENT_REF) goto bad_member; 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 " "type information"); 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"); else - emit_diagnostic (diag_kind, input_location, 0, + emit_diagnostic (diag_kind, loc, 0, "insufficient contextual information to determine type"); break;