decl.c (start_decl): Always pedwarn about vacuously redeclaring a member.
* 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. * call.c (build_scoped_method_call): Make sure get_type_value returns something before we try to use its TYPE_MAIN_VARIANT. From-SVN: r20113
This commit is contained in:
parent
be3a14bbbb
commit
b7698cf042
|
@ -1,7 +1,17 @@
|
|||
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>
|
||||
|
||||
|
|
|
@ -389,13 +389,15 @@ build_scoped_method_call (exp, basetype, name, parms)
|
|||
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);
|
||||
|
|
|
@ -6219,9 +6219,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
|
|||
|| 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);
|
||||
|
||||
|
@ -11815,9 +11813,13 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
|
|||
&& ! 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);
|
||||
}
|
||||
|
|
|
@ -1755,7 +1755,6 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|
|||
}
|
||||
if (TREE_CODE (value) == FUNCTION_DECL)
|
||||
{
|
||||
check_default_args (value);
|
||||
if (asmspec)
|
||||
{
|
||||
/* This must override the asm specifier which was placed
|
||||
|
@ -4500,8 +4499,8 @@ check_default_args (x)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1930,7 +1930,11 @@ do_pending_defargs ()
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue