#include "config.h"
#include "system.h"
+#include "intl.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
push_abi_namespace (void)
{
push_nested_namespace (abi_node);
- push_visibility ("default");
+ push_visibility ("default", 2);
}
static void
pop_abi_namespace (void)
{
- pop_visibility ();
+ pop_visibility (2);
pop_nested_namespace (abi_node);
}
index = build_int_cst (NULL_TREE,
-2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
- offset = build_vtbl_ref (cp_build_indirect_ref (exp, NULL,
+ offset = build_vtbl_ref (cp_build_indirect_ref (exp, RO_NULL,
tf_warning_or_error),
index);
if (error_operand_p (exp))
return error_mark_node;
+ exp = resolve_nondeduced_context (exp);
+
/* peel back references, so they match. */
type = non_reference (TREE_TYPE (exp));
/* 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, NULL, tf_warning_or_error);
+ return cp_build_indirect_ref (t, RO_NULL, tf_warning_or_error);
}
static bool
tree
build_typeid (tree exp)
{
- tree cond = NULL_TREE;
+ tree cond = NULL_TREE, initial_expr = exp;
int nonnull = 0;
if (exp == error_mark_node || !typeid_ok_p ())
&& ! resolves_to_fixed_type_p (exp, &nonnull)
&& ! nonnull)
{
+ /* So we need to look into the vtable of the type of exp.
+ This is an lvalue use of expr then. */
+ exp = mark_lvalue_use (exp);
exp = stabilize_reference (exp);
cond = cp_convert (boolean_type_node, TREE_OPERAND (exp, 0));
}
exp = build3 (COND_EXPR, TREE_TYPE (exp), cond, exp, bad);
}
+ else
+ mark_type_use (initial_expr);
return exp;
}
if (!type)
return error_mark_node;
- return cp_build_indirect_ref (get_tinfo_ptr (type), NULL,
+ return cp_build_indirect_ref (get_tinfo_ptr (type), RO_NULL,
tf_warning_or_error);
}
case REFERENCE_TYPE:
if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (type)))
{
- errstr = "target is not pointer or reference to class";
+ errstr = _("target is not pointer or reference to class");
goto fail;
}
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
{
- errstr = "target is not pointer or reference to complete type";
+ errstr = _("target is not pointer or reference to complete type");
goto fail;
}
break;
default:
- errstr = "target is not pointer or reference";
+ errstr = _("target is not pointer or reference");
goto fail;
}
/* If T is a pointer type, v shall be an rvalue of a pointer to
complete class type, and the result is an rvalue of type T. */
+ expr = mark_rvalue_use (expr);
+
if (TREE_CODE (exprtype) != POINTER_TYPE)
{
- errstr = "source is not a pointer";
+ errstr = _("source is not a pointer");
goto fail;
}
if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (exprtype)))
{
- errstr = "source is not a pointer to class";
+ errstr = _("source is not a pointer to class");
goto fail;
}
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
{
- errstr = "source is a pointer to incomplete type";
+ errstr = _("source is a pointer to incomplete type");
goto fail;
}
}
else
{
+ expr = mark_lvalue_use (expr);
+
exprtype = build_reference_type (exprtype);
/* T is a reference type, v shall be an lvalue of a complete class
if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (exprtype)))
{
- errstr = "source is not of class type";
+ errstr = _("source is not of class type");
goto fail;
}
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
{
- errstr = "source is of incomplete class type";
+ errstr = _("source is of incomplete class type");
goto fail;
}
if (!at_least_as_qualified_p (TREE_TYPE (type),
TREE_TYPE (exprtype)))
{
- errstr = "conversion casts away constness";
+ errstr = _("conversion casts away constness");
goto fail;
}
}
}
else
- errstr = "source type is not polymorphic";
+ errstr = _("source type is not polymorphic");
fail:
if (complain & tf_error)
case BOOLEAN_TYPE:
case REAL_TYPE:
case VOID_TYPE:
+ case NULLPTR_TYPE:
return true;
default:
void
emit_support_tinfos (void)
{
+ /* Dummy static variable so we can put nullptr in the array; it will be
+ set before we actually start to walk the array. */
+ static tree nullptr_type_node;
static tree *const fundamentals[] =
{
&void_type_node,
&long_integer_type_node, &long_unsigned_type_node,
&long_long_integer_type_node, &long_long_unsigned_type_node,
&float_type_node, &double_type_node, &long_double_type_node,
+ &dfloat32_type_node, &dfloat64_type_node, &dfloat128_type_node,
+ &nullptr_type_node,
0
};
int ix;
if (!dtor || DECL_EXTERNAL (dtor))
return;
doing_runtime = 1;
+ nullptr_type_node = TREE_TYPE (nullptr_node);
for (ix = 0; fundamentals[ix]; ix++)
{
tree bltn = *fundamentals[ix];