Commit 9267ee62 by Nathan Sidwell Committed by Nathan Sidwell

decl.c (start_decl): Simplify specialization handling.

	* decl.c (start_decl): Simplify specialization handling. Remove
	unneeded CLASSTYPE_TEMPLATE_INSTANTIATION check.
	* mangle.c (discriminator_for_local_entity): Use VEC_index.

From-SVN: r100488
parent 58fb06b4
2005-06-02 Nathan Sidwell <nathan@codesourcery.com> 2005-06-02 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (start_decl): Simplify specialization handling. Remove
unneeded CLASSTYPE_TEMPLATE_INSTANTIATION check.
* mangle.c (discriminator_for_local_entity): Use VEC_index.
PR c++/20350 PR c++/20350
* decl.c (duplicate_decls): Copy all of DECL_USE_TEMPLATE. * decl.c (duplicate_decls): Copy all of DECL_USE_TEMPLATE.
......
...@@ -3716,22 +3716,22 @@ start_decl (const cp_declarator *declarator, ...@@ -3716,22 +3716,22 @@ start_decl (const cp_declarator *declarator,
/* cp_finish_decl sets DECL_EXTERNAL if DECL_IN_AGGR_P is set. */ /* cp_finish_decl sets DECL_EXTERNAL if DECL_IN_AGGR_P is set. */
DECL_IN_AGGR_P (decl) = 0; DECL_IN_AGGR_P (decl) = 0;
if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl)) /* Do not mark DECL as an explicit specialization if it was not
|| CLASSTYPE_TEMPLATE_INSTANTIATION (context)) already marked as an instantiation; a declaration should
{ never be marked as a specialization unless we know what
/* Do not mark DECL as an explicit specialization if it was template is being specialized. */
not already marked as an instantiation; a declaration if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
should never be marked as a specialization unless we know {
what template is being specialized. */ SET_DECL_TEMPLATE_SPECIALIZATION (decl);
if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
/* [temp.expl.spec] An explicit specialization of a static data /* [temp.expl.spec] An explicit specialization of a static data
member of a template is a definition if the declaration member of a template is a definition if the declaration
includes an initializer; otherwise, it is a declaration. includes an initializer; otherwise, it is a declaration.
We check for processing_specialization so this only applies We check for processing_specialization so this only applies
to the new specialization syntax. */ to the new specialization syntax. */
if (DECL_INITIAL (decl) == NULL_TREE && processing_specialization) if (!DECL_INITIAL (decl)
&& processing_specialization)
DECL_EXTERNAL (decl) = 1; DECL_EXTERNAL (decl) = 1;
} }
......
...@@ -1426,8 +1426,6 @@ write_special_name_destructor (const tree dtor) ...@@ -1426,8 +1426,6 @@ write_special_name_destructor (const tree dtor)
static int static int
discriminator_for_local_entity (tree entity) discriminator_for_local_entity (tree entity)
{ {
tree *type;
/* Assume this is the only local entity with this name. */ /* Assume this is the only local entity with this name. */
int discriminator = 0; int discriminator = 0;
...@@ -1435,12 +1433,19 @@ discriminator_for_local_entity (tree entity) ...@@ -1435,12 +1433,19 @@ discriminator_for_local_entity (tree entity)
discriminator = DECL_DISCRIMINATOR (entity); discriminator = DECL_DISCRIMINATOR (entity);
else if (TREE_CODE (entity) == TYPE_DECL) else if (TREE_CODE (entity) == TYPE_DECL)
{ {
int ix;
/* Scan the list of local classes. */ /* Scan the list of local classes. */
entity = TREE_TYPE (entity); entity = TREE_TYPE (entity);
for (type = VEC_address (tree, local_classes); *type != entity; ++type) for (ix = 0; ; ix++)
if (TYPE_IDENTIFIER (*type) == TYPE_IDENTIFIER (entity) {
&& TYPE_CONTEXT (*type) == TYPE_CONTEXT (entity)) tree type = VEC_index (tree, local_classes, ix);
++discriminator; if (type == entity)
break;
if (TYPE_IDENTIFIER (type) == TYPE_IDENTIFIER (entity)
&& TYPE_CONTEXT (type) == TYPE_CONTEXT (entity))
++discriminator;
}
} }
return discriminator; return discriminator;
......
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