call.c (add_builtin_candidate): legal -> valid, illegal -> invalid.
* call.c (add_builtin_candidate): legal -> valid, illegal -> invalid. (type_decays_to): Likewise. * class.c (find_final_overrider): Likewise. (maybe_note_name_used_in_class): Likewise. * decl.c (current_tmpl_spec_kind): Likewise. (add_binding): Likewise. (push_class_binding): Likewise. (duplicate_decls): Likewise. (layout_var_decl): Likewise. (grokfndecl): Likewise. (grokdeclarator): Likewise. (check_default_argument): Likewise. * decl2.c (handle_class_head): Likewise. * error.c (dump_template_decl): Likewise. * init.c (build_offset_ref): Likewise. * pt.c (check_specialization_scope): Likewise. (determine_specialization): Likewise. (check_explicit_specialization): Likewise. (maybe_check_template_type): Likewise. (process_partial_specialization): Likewise. (check_default_tmpl_args): Likewise. (push_template_decl_real): Likewise. (convert_template_argument): Likewise. (try_class_unification): Likewise. (get_bindings_real): Likewise. (do_decl_instantiation): Likewise. * semantics.c (begin_function_definition): Likewise. (finish_member_declaration): Likewise. (check_multiple_declarators): Likewise. * typeck.c (comp_array_types): Likewise. (comptypes): Likewise. (expr_sizeof): Likewise. (build_binary_op): Likewise. (dubious_conversion_warnings): Likewise. (check_return_expr): Likewise. From-SVN: r56144
This commit is contained in:
parent
9e20be0cb2
commit
0e3397527a
|
@ -1,3 +1,41 @@
|
|||
2002-08-08 Mike Stump <mrs@apple.com>
|
||||
|
||||
* call.c (add_builtin_candidate): legal -> valid, illegal -> invalid.
|
||||
(type_decays_to): Likewise.
|
||||
* class.c (find_final_overrider): Likewise.
|
||||
(maybe_note_name_used_in_class): Likewise.
|
||||
* decl.c (current_tmpl_spec_kind): Likewise.
|
||||
(add_binding): Likewise.
|
||||
(push_class_binding): Likewise.
|
||||
(duplicate_decls): Likewise.
|
||||
(layout_var_decl): Likewise.
|
||||
(grokfndecl): Likewise.
|
||||
(grokdeclarator): Likewise.
|
||||
(check_default_argument): Likewise.
|
||||
* decl2.c (handle_class_head): Likewise.
|
||||
* error.c (dump_template_decl): Likewise.
|
||||
* init.c (build_offset_ref): Likewise.
|
||||
* pt.c (check_specialization_scope): Likewise.
|
||||
(determine_specialization): Likewise.
|
||||
(check_explicit_specialization): Likewise.
|
||||
(maybe_check_template_type): Likewise.
|
||||
(process_partial_specialization): Likewise.
|
||||
(check_default_tmpl_args): Likewise.
|
||||
(push_template_decl_real): Likewise.
|
||||
(convert_template_argument): Likewise.
|
||||
(try_class_unification): Likewise.
|
||||
(get_bindings_real): Likewise.
|
||||
(do_decl_instantiation): Likewise.
|
||||
* semantics.c (begin_function_definition): Likewise.
|
||||
(finish_member_declaration): Likewise.
|
||||
(check_multiple_declarators): Likewise.
|
||||
* typeck.c (comp_array_types): Likewise.
|
||||
(comptypes): Likewise.
|
||||
(expr_sizeof): Likewise.
|
||||
(build_binary_op): Likewise.
|
||||
(dubious_conversion_warnings): Likewise.
|
||||
(check_return_expr): Likewise.
|
||||
|
||||
2002-08-08 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* typeck.c (build_class_member_access_expr): Do not return
|
||||
|
|
|
@ -2020,7 +2020,7 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
|
|||
types are TYPE2. */
|
||||
break;
|
||||
|
||||
/* These arguments do not make for a legal overloaded operator. */
|
||||
/* These arguments do not make for a valid overloaded operator. */
|
||||
return candidates;
|
||||
|
||||
default:
|
||||
|
@ -2070,7 +2070,7 @@ type_decays_to (type)
|
|||
Here we generate a superset of the possible candidates for this particular
|
||||
case. That is a subset of the full set the standard defines, plus some
|
||||
other cases which the standard disallows. add_builtin_candidate will
|
||||
filter out the illegal set. */
|
||||
filter out the invalid set. */
|
||||
|
||||
static struct z_candidate *
|
||||
add_builtin_candidates (candidates, code, code2, fnname, args, flags)
|
||||
|
|
|
@ -2366,7 +2366,7 @@ find_final_overrider (t, binfo, fn)
|
|||
{
|
||||
find_final_overrider_data ffod;
|
||||
|
||||
/* Getting this right is a little tricky. This is legal:
|
||||
/* Getting this right is a little tricky. This is valid:
|
||||
|
||||
struct S { virtual void f (); };
|
||||
struct T { virtual void f (); };
|
||||
|
@ -6389,7 +6389,7 @@ maybe_note_name_used_in_class (name, decl)
|
|||
}
|
||||
|
||||
/* Note that NAME was declared (as DECL) in the current class. Check
|
||||
to see that the declaration is legal. */
|
||||
to see that the declaration is valid. */
|
||||
|
||||
void
|
||||
note_name_declared_in_class (name, decl)
|
||||
|
|
|
@ -709,7 +709,7 @@ current_tmpl_spec_kind (n_class_scopes)
|
|||
|
||||
template <class T> template <> ...
|
||||
|
||||
which is always illegal since [temp.expl.spec] forbids the
|
||||
which is always invalid since [temp.expl.spec] forbids the
|
||||
specialization of a class member template if the enclosing
|
||||
class templates are not explicitly specialized as well. */
|
||||
if (b->template_spec_p)
|
||||
|
@ -746,7 +746,7 @@ current_tmpl_spec_kind (n_class_scopes)
|
|||
|
||||
template <class T> void R<T>::S<T>::f(int);
|
||||
|
||||
This is illegal; there needs to be one set of template
|
||||
This is invalid; there needs to be one set of template
|
||||
parameters for each class. */
|
||||
return tsk_insufficient_parms;
|
||||
else if (n_template_parm_scopes == n_class_scopes)
|
||||
|
@ -932,7 +932,7 @@ push_binding (id, decl, level)
|
|||
stat' hack whereby a non-typedef class-name or enum-name can be
|
||||
bound at the same level as some other kind of entity. It's the
|
||||
responsibility of the caller to check that inserting this name is
|
||||
legal here. Returns nonzero if the new binding was successful. */
|
||||
valid here. Returns nonzero if the new binding was successful. */
|
||||
static int
|
||||
add_binding (id, decl)
|
||||
tree id;
|
||||
|
@ -1069,7 +1069,7 @@ push_class_binding (id, decl)
|
|||
tree context;
|
||||
|
||||
/* Note that we declared this value so that we can issue an error if
|
||||
this an illegal redeclaration of a name already used for some
|
||||
this is an invalid redeclaration of a name already used for some
|
||||
other purpose. */
|
||||
note_name_declared_in_class (id, decl);
|
||||
|
||||
|
@ -3213,7 +3213,7 @@ duplicate_decls (newdecl, olddecl)
|
|||
specialization, and the other is an instantiation of the same
|
||||
template, that we do not exit at this point. That situation
|
||||
can occur if we instantiate a template class, and then
|
||||
specialize one of its methods. This situation is legal, but
|
||||
specialize one of its methods. This situation is valid, but
|
||||
the declarations must be merged in the usual way. */
|
||||
return 0;
|
||||
else if (TREE_CODE (newdecl) == FUNCTION_DECL
|
||||
|
@ -7615,7 +7615,7 @@ layout_var_decl (decl)
|
|||
/* If we haven't already layed out this declaration, do so now.
|
||||
Note that we must not call complete type for an external object
|
||||
because it's type might involve templates that we are not
|
||||
supposed to isntantiate yet. (And it's perfectly legal to say
|
||||
supposed to isntantiate yet. (And it's perfectly valid to say
|
||||
`extern X x' for some incomplete type `X'.) */
|
||||
if (!DECL_EXTERNAL (decl))
|
||||
complete_type (type);
|
||||
|
@ -9117,7 +9117,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
|
|||
decl = DECL_TEMPLATE_RESULT (decl);
|
||||
|
||||
/* Attempt to merge the declarations. This can fail, in
|
||||
the case of some illegal specialization declarations. */
|
||||
the case of some invalid specialization declarations. */
|
||||
if (!duplicate_decls (decl, old_decl))
|
||||
error ("no `%#D' member function declared in class `%T'",
|
||||
decl, ctype);
|
||||
|
@ -11815,23 +11815,23 @@ friend declaration requires class-key, i.e. `friend %#T'",
|
|||
|
||||
if (staticp == 1)
|
||||
{
|
||||
int illegal_static = 0;
|
||||
int invalid_static = 0;
|
||||
|
||||
/* Don't allow a static member function in a class, and forbid
|
||||
declaring main to be static. */
|
||||
if (TREE_CODE (type) == METHOD_TYPE)
|
||||
{
|
||||
pedwarn ("cannot declare member function `%D' to have static linkage", decl);
|
||||
illegal_static = 1;
|
||||
invalid_static = 1;
|
||||
}
|
||||
else if (current_function_decl)
|
||||
{
|
||||
/* FIXME need arm citation */
|
||||
error ("cannot declare static function inside another function");
|
||||
illegal_static = 1;
|
||||
invalid_static = 1;
|
||||
}
|
||||
|
||||
if (illegal_static)
|
||||
if (invalid_static)
|
||||
{
|
||||
staticp = 0;
|
||||
RIDBIT_RESET (RID_STATIC, specbits);
|
||||
|
@ -11989,7 +11989,7 @@ local_variable_p_walkfn (tp, walk_subtrees, data)
|
|||
}
|
||||
|
||||
/* Check that ARG, which is a default-argument expression for a
|
||||
parameter DECL, is legal. Returns ARG, or ERROR_MARK_NODE, if
|
||||
parameter DECL, is valid. Returns ARG, or ERROR_MARK_NODE, if
|
||||
something goes wrong. DECL may also be a _TYPE node, rather than a
|
||||
DECL, if there is no DECL available. */
|
||||
|
||||
|
|
|
@ -4826,7 +4826,7 @@ handle_class_head (tag_kind, scope, id, attributes, defn_p, new_type_p)
|
|||
push_scope (context);
|
||||
|
||||
if (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE)
|
||||
/* It is legal to define a class with a different class key,
|
||||
/* It is valid to define a class with a different class key,
|
||||
and this changes the default member access. */
|
||||
CLASSTYPE_DECLARED_CLASS (TREE_TYPE (decl))
|
||||
= (tag_kind == class_type);
|
||||
|
|
|
@ -1063,7 +1063,7 @@ dump_template_decl (t, flags)
|
|||
dump_function_decl (t, flags | TFF_TEMPLATE_NAME);
|
||||
break;
|
||||
default:
|
||||
/* This case can occur with some illegal code. */
|
||||
/* This case can occur with some invalid code. */
|
||||
dump_type (TREE_TYPE (t),
|
||||
(flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
|
||||
| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0));
|
||||
|
|
|
@ -1756,7 +1756,7 @@ build_offset_ref (type, name)
|
|||
|
||||
if (TREE_CODE (t) == FIELD_DECL && DECL_C_BIT_FIELD (t))
|
||||
{
|
||||
error ("illegal pointer to bit-field `%D'", t);
|
||||
error ("invalid pointer to bit-field `%D'", t);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
|
34
gcc/cp/pt.c
34
gcc/cp/pt.c
|
@ -585,7 +585,7 @@ begin_template_parm_list ()
|
|||
}
|
||||
|
||||
/* This routine is called when a specialization is declared. If it is
|
||||
illegal to declare a specialization here, an error is reported. */
|
||||
invalid to declare a specialization here, an error is reported. */
|
||||
|
||||
static void
|
||||
check_specialization_scope ()
|
||||
|
@ -1011,7 +1011,7 @@ determine_specialization (template_id, decl, targs_out,
|
|||
For example,
|
||||
template <class T> void f(int i = 0);
|
||||
template <> void f<int>();
|
||||
The specialization f<int> is illegal but is not caught
|
||||
The specialization f<int> is invalid but is not caught
|
||||
by get_bindings below. */
|
||||
|
||||
if (list_length (TYPE_ARG_TYPES (TREE_TYPE (fn)))
|
||||
|
@ -1110,7 +1110,7 @@ determine_specialization (template_id, decl, targs_out,
|
|||
template.
|
||||
|
||||
So, we do use the partial ordering rules, at least for now.
|
||||
This extension can only serve to make illegal programs legal,
|
||||
This extension can only serve to make invalid programs valid,
|
||||
so it's safe. And, there is strong anecdotal evidence that
|
||||
the committee intended the partial ordering rules to apply;
|
||||
the EDG front-end has that behavior, and John Spicer claims
|
||||
|
@ -1315,7 +1315,7 @@ copy_default_args_to_explicit_spec (decl)
|
|||
template <> void S<int>::f();
|
||||
|
||||
the TEMPLATE_COUNT would be 0. (Note that this declaration is
|
||||
illegal; there should be no template <>.)
|
||||
invalid; there should be no template <>.)
|
||||
|
||||
If the function is a specialization, it is marked as such via
|
||||
DECL_TEMPLATE_SPECIALIZATION. Furthermore, its DECL_TEMPLATE_INFO
|
||||
|
@ -1416,7 +1416,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
template <class T> struct S { void f(); };
|
||||
void S<int>::f() {} // Missing template <>
|
||||
|
||||
That used to be legal C++. */
|
||||
That used to be valid C++. */
|
||||
if (pedantic)
|
||||
pedwarn
|
||||
("explicit specialization not preceded by `template <>'");
|
||||
|
@ -1498,13 +1498,13 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
if (ctype != NULL_TREE && TYPE_BEING_DEFINED (ctype))
|
||||
{
|
||||
if (!explicit_instantiation)
|
||||
/* A specialization in class scope. This is illegal,
|
||||
/* A specialization in class scope. This is invalid,
|
||||
but the error will already have been flagged by
|
||||
check_specialization_scope. */
|
||||
return error_mark_node;
|
||||
else
|
||||
{
|
||||
/* It's not legal to write an explicit instantiation in
|
||||
/* It's not valid to write an explicit instantiation in
|
||||
class scope, e.g.:
|
||||
|
||||
class C { template void f(); }
|
||||
|
@ -1514,7 +1514,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
|
||||
template class C { void f(); };
|
||||
|
||||
(which is illegal) we can get here. The error will be
|
||||
(which is invalid) we can get here. The error will be
|
||||
issued later. */
|
||||
;
|
||||
}
|
||||
|
@ -1734,7 +1734,7 @@ maybe_check_template_type (type)
|
|||
struct I {};
|
||||
};
|
||||
|
||||
is illegal, but:
|
||||
is invalid, but:
|
||||
|
||||
template <class T> struct S {
|
||||
template <class U> struct I;
|
||||
|
@ -2220,7 +2220,7 @@ process_partial_specialization (decl)
|
|||
struct S2<T>;
|
||||
};
|
||||
|
||||
The S2<T> declaration is actually illegal; it is a
|
||||
The S2<T> declaration is actually invalid; it is a
|
||||
full-specialization. Of course,
|
||||
|
||||
template <class U>
|
||||
|
@ -2459,7 +2459,7 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
|
|||
/* If we're inside a class definition, there's no need to
|
||||
examine the parameters to the class itself. On the one
|
||||
hand, they will be checked when the class is defined, and,
|
||||
on the other, default arguments are legal in things like:
|
||||
on the other, default arguments are valid in things like:
|
||||
template <class T = double>
|
||||
struct S { template <class U> void f(U); };
|
||||
Here the default argument for `S' has no bearing on the
|
||||
|
@ -2615,7 +2615,7 @@ push_template_decl_real (decl, is_friend)
|
|||
{
|
||||
/* Since a template declaration already existed for this
|
||||
class-type, we must be redeclaring it here. Make sure
|
||||
that the redeclaration is legal. */
|
||||
that the redeclaration is valid. */
|
||||
redeclare_class_template (TREE_TYPE (decl),
|
||||
current_template_parms);
|
||||
/* We don't need to create a new TEMPLATE_DECL; just use the
|
||||
|
@ -3323,7 +3323,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
|
|||
{
|
||||
/* The template argument was the name of some
|
||||
member function. That's usually
|
||||
illegal, but static members are OK. In any
|
||||
invalid, but static members are OK. In any
|
||||
case, grab the underlying fields/functions
|
||||
and issue an error later if required. */
|
||||
arg = TREE_VALUE (arg);
|
||||
|
@ -3489,7 +3489,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
|
|||
extension, since deciding whether or not these
|
||||
conversions can occur is part of determining which
|
||||
function template to call, or whether a given explicit
|
||||
argument specification is legal. */
|
||||
argument specification is valid. */
|
||||
val = convert_nontype_argument (t, arg);
|
||||
else
|
||||
val = arg;
|
||||
|
@ -8414,7 +8414,7 @@ try_class_unification (tparms, targs, parm, arg)
|
|||
|
||||
Now, by the time we consider the unification involving `s2', we
|
||||
already know that we must have `f<0, 0, 0>'. But, even though
|
||||
`S<0, 1, 2>' is derived from `S<0, 0, 0>', the code is not legal
|
||||
`S<0, 1, 2>' is derived from `S<0, 0, 0>', the code is invalid
|
||||
because there are two ways to unify base classes of S<0, 1, 2>
|
||||
with S<I, I, I>. If we kept the already deduced knowledge, we
|
||||
would reject the possibility I=1. */
|
||||
|
@ -9257,7 +9257,7 @@ get_bindings_real (fn, decl, explicit_args, check_rettype, deduce, len)
|
|||
if (DECL_TEMPLATE_INFO (decl))
|
||||
tmpl = DECL_TI_TEMPLATE (decl);
|
||||
else
|
||||
/* We can get here for some illegal specializations. */
|
||||
/* We can get here for some invalid specializations. */
|
||||
return NULL_TREE;
|
||||
|
||||
converted_args
|
||||
|
@ -9571,7 +9571,7 @@ do_decl_instantiation (tree decl, tree storage)
|
|||
result = decl;
|
||||
|
||||
/* Check for various error cases. Note that if the explicit
|
||||
instantiation is legal the RESULT will currently be marked as an
|
||||
instantiation is valid the RESULT will currently be marked as an
|
||||
*implicit* instantiation; DECL_EXPLICIT_INSTANTIATION is not set
|
||||
until we get here. */
|
||||
|
||||
|
|
|
@ -1551,7 +1551,7 @@ reset_type_access_control ()
|
|||
|
||||
/* Begin a function definition declared with DECL_SPECS, ATTRIBUTES,
|
||||
and DECLARATOR. Returns non-zero if the function-declaration is
|
||||
legal. */
|
||||
valid. */
|
||||
|
||||
int
|
||||
begin_function_definition (decl_specs, attributes, declarator)
|
||||
|
@ -1877,7 +1877,7 @@ finish_member_declaration (decl)
|
|||
struct S { enum E { }; int E } s;
|
||||
s.E = 3;
|
||||
|
||||
is legal. In addition, the FIELD_DECLs must be maintained in
|
||||
is valid. In addition, the FIELD_DECLs must be maintained in
|
||||
declaration order so that class layout works as expected.
|
||||
However, we don't need that order until class layout, so we
|
||||
save a little time by putting FIELD_DECLs on in reverse order
|
||||
|
@ -2094,7 +2094,7 @@ check_multiple_declarators ()
|
|||
contain at most one declarator.
|
||||
|
||||
We don't just use PROCESSING_TEMPLATE_DECL for the first
|
||||
condition since that would disallow the perfectly legal code,
|
||||
condition since that would disallow the perfectly valid code,
|
||||
like `template <class T> struct S { int i, j; };'. */
|
||||
if (at_function_scope_p ())
|
||||
/* It's OK to write `template <class T> void f() { int i, j;}'. */
|
||||
|
|
|
@ -857,7 +857,7 @@ comp_array_types (cmp, t1, t2, strict)
|
|||
return 1;
|
||||
|
||||
/* If one of the arrays is dimensionless, and the other has a
|
||||
dimension, they are of different types. However, it is legal to
|
||||
dimension, they are of different types. However, it is valid to
|
||||
write:
|
||||
|
||||
extern int a[];
|
||||
|
@ -897,7 +897,7 @@ comptypes (t1, t2, strict)
|
|||
extern int (*i)[];
|
||||
int (*i)[8];
|
||||
|
||||
is not legal, for example. */
|
||||
is invalid, for example. */
|
||||
strict &= ~COMPARE_REDECLARATION;
|
||||
|
||||
/* Suppress errors caused by previously reported errors */
|
||||
|
@ -1543,7 +1543,7 @@ expr_sizeof (e)
|
|||
cxx_incomplete_type_error (e, TREE_TYPE (e));
|
||||
return c_sizeof (char_type_node);
|
||||
}
|
||||
/* It's illegal to say `sizeof (X::i)' for `i' a non-static data
|
||||
/* It's invalid to say `sizeof (X::i)' for `i' a non-static data
|
||||
member unless you're in a non-static member of X. So hand off to
|
||||
resolve_offset_ref. [expr.prim] */
|
||||
else if (TREE_CODE (e) == OFFSET_REF)
|
||||
|
@ -3618,7 +3618,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
|
|||
return error_mark_node;
|
||||
}
|
||||
|
||||
/* Issue warnings about peculiar, but legal, uses of NULL. */
|
||||
/* Issue warnings about peculiar, but valid, uses of NULL. */
|
||||
if (/* It's reasonable to use pointer values as operands of &&
|
||||
and ||, so NULL is no exception. */
|
||||
!(code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR)
|
||||
|
@ -5713,7 +5713,7 @@ dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
|
|||
if (TREE_CODE (type) == REFERENCE_TYPE)
|
||||
type = TREE_TYPE (type);
|
||||
|
||||
/* Issue warnings about peculiar, but legal, uses of NULL. */
|
||||
/* Issue warnings about peculiar, but valid, uses of NULL. */
|
||||
if (ARITHMETIC_TYPE_P (type) && expr == null_node)
|
||||
{
|
||||
if (fndecl)
|
||||
|
@ -6065,7 +6065,7 @@ maybe_warn_about_returning_address_of_local (retval)
|
|||
}
|
||||
}
|
||||
|
||||
/* Check that returning RETVAL from the current function is legal.
|
||||
/* Check that returning RETVAL from the current function is valid.
|
||||
Return an expression explicitly showing all conversions required to
|
||||
change RETVAL into the function return type, and to assign it to
|
||||
the DECL_RESULT for the function. */
|
||||
|
|
Loading…
Reference in New Issue