+1998-05-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Always pedwarn about vacuously redeclaring
+ a member.
+ (start_function): Call check_default_args.
+ * decl2.c (grokfield): Don't call check_default_args.
+ (check_default_args): Use cp_error_at.
+ * lex.c (do_pending_defargs): Call check_default_args.
+
1998-05-27 Brendan Kehoe <brendan@cygnus.com>
* call.c (build_method_call): Make sure get_type_value returns
something before we try to use its TYPE_MAIN_VARIANT.
+ (build_scoped_method_call): Likewise.
1998-05-27 Jason Merrill <jason@yorick.cygnus.com>
and template parms. */
if (TREE_CODE (name) == BIT_NOT_EXPR && ! IS_AGGR_TYPE (basetype))
{
+ tree tmp;
if (TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (basetype))
cp_error ("type of `%E' does not match destructor type `%T' (type was `%T')",
exp, basetype, type);
name = TREE_OPERAND (name, 0);
- if (TYPE_MAIN_VARIANT (basetype) != name
- && (TYPE_MAIN_VARIANT (basetype)
- != TYPE_MAIN_VARIANT (get_type_value (name))))
+ if (! (name == TYPE_MAIN_VARIANT (basetype)
+ || ((tmp = get_type_value (name))
+ && (TYPE_MAIN_VARIANT (basetype)
+ == TYPE_MAIN_VARIANT (tmp)))))
cp_error ("qualified type `%T' does not match destructor name `~%T'",
basetype, name);
return cp_convert (void_type_node, exp);
|| CLASSTYPE_USE_TEMPLATE (context))
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
- /* Stupid stupid stupid stupid (jason 7/21/95) */
- if (pedantic && DECL_EXTERNAL (decl)
- && ! DECL_TEMPLATE_SPECIALIZATION (decl))
+ if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
cp_pedwarn ("declaration of `%#D' outside of class is not definition",
decl);
&& ! DECL_FUNCTION_MEMBER_P (decl1))
decl1 = pushdecl (decl1);
else
- /* We need to set the DECL_CONTEXT. */
- if (!DECL_CONTEXT (decl1) && DECL_TEMPLATE_INFO (decl1))
- DECL_CONTEXT (decl1) = DECL_CONTEXT (DECL_TI_TEMPLATE (decl1));
+ {
+ /* We need to set the DECL_CONTEXT. */
+ if (!DECL_CONTEXT (decl1) && DECL_TEMPLATE_INFO (decl1))
+ DECL_CONTEXT (decl1) = DECL_CONTEXT (DECL_TI_TEMPLATE (decl1));
+ /* And make sure we have enough default args. */
+ check_default_args (decl1);
+ }
DECL_MAIN_VARIANT (decl1) = decl1;
fntype = TREE_TYPE (decl1);
}
}
if (TREE_CODE (value) == FUNCTION_DECL)
{
- check_default_args (value);
if (asmspec)
{
/* This must override the asm specifier which was placed
saw_def = 1;
else if (saw_def)
{
- cp_error ("default argument missing for parameter %P of `%#D'",
- i, x);
+ cp_error_at ("default argument missing for parameter %P of `%+#D'",
+ i, x);
break;
}
}
}
if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
- maybe_end_member_template_processing (defarg_fn);
+ {
+ maybe_end_member_template_processing (defarg_fn);
+ check_default_args (defarg_fn);
+ }
+
poplevel (0, 0, 0);
pop_nested_class (1);
}