Commit e8bd800e by Mark Mitchell Committed by Mark Mitchell

decl.c (build_enumerator): Set DECL_CONTEXT for the CONST_DECLs.

	* decl.c (build_enumerator): Set DECL_CONTEXT for the
	CONST_DECLs.

From-SVN: r22014
parent 563f648b
1998-08-27 Mark Mitchell <mark@markmitchell.com>
* decl.c (build_enumerator): Set DECL_CONTEXT for the
CONST_DECLs.
1998-08-26 Mark Mitchell <mark@markmitchell.com> 1998-08-26 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (finish_enum): Change prototype. * cp-tree.h (finish_enum): Change prototype.
......
...@@ -11994,6 +11994,7 @@ build_enumerator (name, value) ...@@ -11994,6 +11994,7 @@ build_enumerator (name, value)
tree name, value; tree name, value;
{ {
tree decl, result; tree decl, result;
tree context;
/* Remove no-op casts from the value. */ /* Remove no-op casts from the value. */
if (value) if (value)
...@@ -12042,30 +12043,31 @@ build_enumerator (name, value) ...@@ -12042,30 +12043,31 @@ build_enumerator (name, value)
value = copy_node (value); value = copy_node (value);
/* C++ associates enums with global, function, or class declarations. */ /* C++ associates enums with global, function, or class declarations. */
decl = current_scope (); context = current_scope ();
if (decl && decl == current_class_type) if (context && context == current_class_type)
{ /* This enum declaration is local to the class. */
/* This enum declaration is local to the class, so we must put decl = build_lang_field_decl (CONST_DECL, name, integer_type_node);
it in that class's list of decls. */ else
decl = build_lang_field_decl (CONST_DECL, name, integer_type_node); /* It's a global enum, or it's local to a function. (Note local to
DECL_INITIAL (decl) = value; a function could mean local to a class method. */
TREE_READONLY (decl) = 1; decl = build_decl (CONST_DECL, name, integer_type_node);
pushdecl_class_level (decl);
TREE_CHAIN (decl) = current_local_enum; DECL_CONTEXT (decl) = FROB_CONTEXT (context);
current_local_enum = decl; DECL_INITIAL (decl) = value;
} TREE_READONLY (decl) = 1;
else
{ if (context && context == current_class_type)
/* It's a global enum, or it's local to a function. (Note local to {
a function could mean local to a class method. */ pushdecl_class_level (decl);
decl = build_decl (CONST_DECL, name, integer_type_node); TREE_CHAIN (decl) = current_local_enum;
DECL_INITIAL (decl) = value; current_local_enum = decl;
TREE_READONLY (decl) = 1; }
else
pushdecl (decl); {
GNU_xref_decl (current_function_decl, decl); pushdecl (decl);
} GNU_xref_decl (current_function_decl, decl);
}
if (! processing_template_decl) if (! processing_template_decl)
{ {
......
// Build don't link:
template <typename _CharT>
class _Format_cache
{
public:
enum {
_S_digits, _S_digits_end = _S_digits+10,
_S_xdigits = _S_digits_end,
};
};
template class _Format_cache<int>;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment