extern GTY(()) vec<tree, va_gc> *unemitted_tinfo_decls;
extern void init_rtti_processing (void);
-extern tree build_typeid (tree);
+extern tree build_typeid (tree, tsubst_flags_t);
extern tree get_tinfo_decl (tree);
-extern tree get_typeid (tree);
+extern tree get_typeid (tree, tsubst_flags_t);
extern tree build_headof (tree);
extern tree build_dynamic_cast (tree, tree, tsubst_flags_t);
extern void emit_support_tinfos (void);
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
/* If all went well, simply lookup the type-id. */
if (cp_parser_parse_definitely (parser))
- postfix_expression = get_typeid (type);
+ postfix_expression = get_typeid (type, tf_warning_or_error);
/* Otherwise, fall back to the expression variant. */
else
{
/* Look for an expression. */
expression = cp_parser_expression (parser, /*cast_p=*/false, & idk);
/* Compute its typeid. */
- postfix_expression = build_typeid (expression);
+ postfix_expression = build_typeid (expression, tf_warning_or_error);
/* Look for the `)' token. */
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
}
static tree build_dynamic_cast_1 (tree, tree, tsubst_flags_t);
static tree throw_bad_cast (void);
static tree throw_bad_typeid (void);
-static tree get_tinfo_decl_dynamic (tree);
static tree get_tinfo_ptr (tree);
static bool typeid_ok_p (void);
static int qualifier_flags (tree);
otherwise return the static type of the expression. */
static tree
-get_tinfo_decl_dynamic (tree exp)
+get_tinfo_decl_dynamic (tree exp, tsubst_flags_t complain)
{
tree type;
tree t;
/* For UNKNOWN_TYPEs call complete_type_or_else to get diagnostics. */
if (CLASS_TYPE_P (type) || type == unknown_type_node
|| type == init_list_type_node)
- type = complete_type_or_else (type, exp);
+ type = complete_type_or_maybe_complain (type, exp, complain);
if (!type)
return error_mark_node;
/* Otherwise return the type_info for the static type of the expr. */
t = get_tinfo_ptr (TYPE_MAIN_VARIANT (type));
- return cp_build_indirect_ref (t, RO_NULL, tf_warning_or_error);
+ return cp_build_indirect_ref (t, RO_NULL, complain);
}
static bool
an lvalue of type "const std::type_info". */
tree
-build_typeid (tree exp)
+build_typeid (tree exp, tsubst_flags_t complain)
{
tree cond = NULL_TREE, initial_expr = exp;
int nonnull = 0;
exp = mark_lvalue_use (exp);
exp = stabilize_reference (exp);
cond = cp_convert (boolean_type_node, TREE_OPERAND (exp, 0),
- tf_warning_or_error);
+ complain);
}
- exp = get_tinfo_decl_dynamic (exp);
+ exp = get_tinfo_decl_dynamic (exp, complain);
if (exp == error_mark_node)
return error_mark_node;
/* Return the type_info object for TYPE. */
tree
-get_typeid (tree type)
+get_typeid (tree type, tsubst_flags_t complain)
{
if (type == error_mark_node || !typeid_ok_p ())
return error_mark_node;
/* For UNKNOWN_TYPEs call complete_type_or_else to get diagnostics. */
if (CLASS_TYPE_P (type) || type == unknown_type_node
|| type == init_list_type_node)
- type = complete_type_or_else (type, NULL_TREE);
+ type = complete_type_or_maybe_complain (type, NULL_TREE, complain);
if (!type)
return error_mark_node;
- return cp_build_indirect_ref (get_tinfo_ptr (type), RO_NULL,
- tf_warning_or_error);
+ return cp_build_indirect_ref (get_tinfo_ptr (type), RO_NULL, complain);
}
/* Check whether TEST is null before returning RESULT. If TEST is used in