* class.c (instantiate_type): Be more helpful.
* decl2.c (import_export_decl): Call import_export_class.
* cp-tree.h (EMPTY_CONSTRUCTOR_P): Check !TREE_HAS_CONSTRUCTOR.
* decl2.c (build_expr_from_tree): Propagate TREE_HAS_CONSTRUCTOR.
* pt.c (tsubst_copy): Likewise.
From-SVN: r23511
+1998-11-02 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (instantiate_type): Be more helpful.
+
+ * decl2.c (import_export_decl): Call import_export_class.
+
+ * cp-tree.h (EMPTY_CONSTRUCTOR_P): Check !TREE_HAS_CONSTRUCTOR.
+ * decl2.c (build_expr_from_tree): Propagate TREE_HAS_CONSTRUCTOR.
+ * pt.c (tsubst_copy): Likewise.
+
1998-11-02 Mark Mitchell <mark@markmitchell.com>
* init.c (expand_vec_init): Fix off-by-one error.
my_friendly_assert (TREE_CODE (function) == FUNCTION_DECL, 185);
if (! DECL_STATIC_FUNCTION_P (function))
- cp_error ("reference to `%D' can only be used in a call",
- function);
+ {
+ tree t = TREE_TYPE (TREE_OPERAND (rhs, 0));
+ if (TYPE_MAIN_VARIANT (t) == current_class_type)
+ t = constructor_name (t);
+
+ cp_error ("object-dependent reference to `%D' can only be used in a call",
+ function);
+ cp_error (" to form a pointer to member function, say `&%T::%D'",
+ t, DECL_NAME (function));
+ }
mark_used (function);
return function;
has been duly initialized in its constructor. */
#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
-#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
- && CONSTRUCTOR_ELTS (NODE) == NULL_TREE)
+#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
+ && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
+ && ! TREE_HAS_CONSTRUCTOR (NODE))
#if 0
/* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
else if (DECL_FUNCTION_MEMBER_P (decl))
{
tree ctype = DECL_CLASS_CONTEXT (decl);
+ import_export_class (ctype);
if (CLASSTYPE_INTERFACE_KNOWN (ctype)
&& (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl)))
{
else if (DECL_ARTIFICIAL (decl) && DECL_MUTABLE_P (decl))
{
tree ctype = TREE_TYPE (DECL_NAME (decl));
+
+ if (IS_AGGR_TYPE (ctype))
+ import_export_class (ctype);
+
if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype)
&& TYPE_VIRTUAL_P (ctype)
/* If the type is a cv-qualified variant of a type, then we
r = build_nt (CONSTRUCTOR, NULL_TREE,
build_expr_from_tree (CONSTRUCTOR_ELTS (t)));
+ TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
if (TREE_TYPE (t))
return digest_init (TREE_TYPE (t), r, 0);
tree in_decl;
{
enum tree_code code;
+ tree r;
if (t == NULL_TREE || t == error_mark_node)
return t;
if (id != TREE_OPERAND (t, 0))
{
- tree r = build_nt (LOOKUP_EXPR, id);
+ r = build_nt (LOOKUP_EXPR, id);
LOOKUP_EXPR_GLOBAL (r) = LOOKUP_EXPR_GLOBAL (t);
t = r;
}
case COND_EXPR:
case MODOP_EXPR:
{
- tree r = build_nt
+ r = build_nt
(code, tsubst_copy (TREE_OPERAND (t, 0), args, in_decl),
tsubst_copy (TREE_OPERAND (t, 1), args, in_decl),
tsubst_copy (TREE_OPERAND (t, 2), args, in_decl));
case NEW_EXPR:
{
- tree r = build_nt
+ r = build_nt
(code, tsubst_copy (TREE_OPERAND (t, 0), args, in_decl),
tsubst_copy (TREE_OPERAND (t, 1), args, in_decl),
tsubst_copy (TREE_OPERAND (t, 2), args, in_decl));
case DELETE_EXPR:
{
- tree r = build_nt
+ r = build_nt
(code, tsubst_copy (TREE_OPERAND (t, 0), args, in_decl),
tsubst_copy (TREE_OPERAND (t, 1), args, in_decl));
DELETE_EXPR_USE_GLOBAL (r) = DELETE_EXPR_USE_GLOBAL (t);
return t;
case CONSTRUCTOR:
- return build
- (CONSTRUCTOR, tsubst (TREE_TYPE (t), args, in_decl), NULL_TREE,
- tsubst_copy (CONSTRUCTOR_ELTS (t), args, in_decl));
+ {
+ r = build
+ (CONSTRUCTOR, tsubst (TREE_TYPE (t), args, in_decl), NULL_TREE,
+ tsubst_copy (CONSTRUCTOR_ELTS (t), args, in_decl));
+ TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
+ return r;
+ }
default:
return t;