summaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-26 17:41:50 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-26 17:41:50 +0000
commit7f23361694c7a6868204cb1d835afb067fef7a8f (patch)
treef1fbe8b9a2f8a334b51dc3db7b4365cfa40b5582 /gcc/cp/init.c
parent5c359c6fc85e8e5b72bab489925ce37c7ef48d78 (diff)
downloadgcc-7f23361694c7a6868204cb1d835afb067fef7a8f.tar.gz
* class.c (add_method): Just check processing_template_decl to
determine whether or not we are within a template. * decl2.c (maybe_retrofit_in_chrg): Likewise. * init.c (decl_constant_value): Check the type of the declaration, not TREE_READONLY. * name-lookup.c (maybe_push_to_top_level): Rename to ... (push_to_top_level): ... this. * name-lookup.h (maybe_push_to_top_level): Do not declare it. * pt.c (push_template_decl_real): Reorder condition for speed. (convert_template_argument): Use dependency-checking functions in place of uses_template_parms. (lookup_template_class): Avoid calling uses_template_parms more than once. (uses_template_parms): Reimplement, using dependency-checking functions. (instantiate_class_template): Use push_to_top_level, not maybe_push_to_top_level. (type_unification_real): Simplify. (type_dependent_expression_p): Handle OFFSET_REFs and TEMPLATE_DECLs. (any_dependent_template_arguments_p): Handle multiple levels of template argument. * semantics.c (expand_or_defer_fn): Do not check uses_template_parms for template instantiations. * typeck.c (comptypes): Avoid calling cp_type_quals. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76647 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3aec7d64120..6f361b082b3 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1610,8 +1610,12 @@ decl_constant_value (tree decl)
TREE_OPERAND (decl, 0), d1, d2);
}
- if (TREE_READONLY_DECL_P (decl)
- && ! TREE_THIS_VOLATILE (decl)
+ if (DECL_P (decl)
+ && (/* Enumeration constants are constant. */
+ TREE_CODE (decl) == CONST_DECL
+ /* And so are variables with a 'const' type -- unless they
+ are also 'volatile'. */
+ || CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl)))
&& DECL_INITIAL (decl)
&& DECL_INITIAL (decl) != error_mark_node
/* This is invalid if initial value is not constant.