/* in typeck2.cc */
extern void require_complete_eh_spec_types (tree, tree);
-extern void cxx_incomplete_type_diagnostic (location_t, const_tree,
+extern bool cxx_incomplete_type_diagnostic (location_t, const_tree,
const_tree, diagnostic_t);
inline location_t
loc_or_input_loc (location_t loc)
return cp_expr_loc_or_loc (t, input_location);
}
-inline void
+inline bool
cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
diagnostic_t diag_kind)
{
- cxx_incomplete_type_diagnostic (cp_expr_loc_or_input_loc (value),
- value, type, diag_kind);
+ return cxx_incomplete_type_diagnostic (cp_expr_loc_or_input_loc (value),
+ value, type, diag_kind);
}
extern void cxx_incomplete_type_error (location_t, const_tree,
and TYPE is the type that was invalid. DIAG_KIND indicates the
type of diagnostic (see diagnostic.def). */
-void
+bool
cxx_incomplete_type_diagnostic (location_t loc, const_tree value,
const_tree type, diagnostic_t diag_kind)
{
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
- return;
+ return false;
if (value)
{
break;
case VOID_TYPE:
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of %qT", type);
break;
type = TREE_TYPE (type);
goto retry;
}
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of array with unspecified bounds");
break;
add a fix-it hint. */
if (type_num_arguments (TREE_TYPE (member)) == 1)
richloc.add_fixit_insert_after ("()");
- emit_diagnostic (diag_kind, &richloc, 0,
+ complained = emit_diagnostic (diag_kind, &richloc, 0,
"invalid use of member function %qD "
"(did you forget the %<()%> ?)", member);
}
else
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of member %qD "
"(did you forget the %<&%> ?)", member);
}
if (is_auto (type))
{
if (CLASS_PLACEHOLDER_TEMPLATE (type))
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of placeholder %qT", type);
else
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of %qT", type);
}
else
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of template type parameter %qT", type);
break;
case BOUND_TEMPLATE_TEMPLATE_PARM:
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of template template parameter %qT",
TYPE_NAME (type));
break;
case TYPE_PACK_EXPANSION:
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of pack expansion %qT", type);
break;
case TYPENAME_TYPE:
case DECLTYPE_TYPE:
- emit_diagnostic (diag_kind, loc, 0,
+ complained = 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, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"invalid use of brace-enclosed initializer list");
break;
}
if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR)
- emit_diagnostic (diag_kind, loc, 0,
+ complained = 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, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"overloaded function with no contextual type information");
else
- emit_diagnostic (diag_kind, loc, 0,
+ complained = emit_diagnostic (diag_kind, loc, 0,
"insufficient contextual information to determine type");
break;
default:
gcc_unreachable ();
}
+
+ return complained;
}
/* Print an error message for invalid use of an incomplete type.