(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56144
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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:
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)
{
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 (); };
}
/* 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)
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)
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)
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;
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);
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
/* 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);
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);
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);
}
/* 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. */
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);
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));
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;
}
}
/* 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 ()
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)))
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
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
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 <>'");
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(); }
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. */
;
}
struct I {};
};
- is illegal, but:
+ is invalid, but:
template <class T> struct S {
template <class U> struct I;
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>
/* 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
{
/* 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
{
/* 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);
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;
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. */
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
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. */
/* 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)
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
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;}'. */
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[];
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 */
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)
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)
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)
}
}
-/* 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. */