diff options
author | Mark Mitchell <mark@codesourcery.com> | 2006-01-04 01:04:51 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2006-01-04 01:04:51 +0000 |
commit | 862e1e62fcf86a05434abd3b83a7ad89c39c6f44 (patch) | |
tree | 777031142703d177a212c16367bd180fc4f36a18 /gcc/cp | |
parent | 8f9f2d0f2b81add413c0ab207392d75c5788931e (diff) | |
download | gcc-862e1e62fcf86a05434abd3b83a7ad89c39c6f44.zip gcc-862e1e62fcf86a05434abd3b83a7ad89c39c6f44.tar.gz gcc-862e1e62fcf86a05434abd3b83a7ad89c39c6f44.tar.bz2 |
re PR c++/25492 (friend class nested in derived class problem)
PR c++/25492
* name-lookup.c (push_class_level_binding): When a derived class
provides a type binding, eliminate any type binding from a base
class.
PR c++/25625
* repo.c (repo_emit_p): Always instantiate static data members
initialized by constant expressions, so that there values are
available.
PR c++/25492
* g++.dg/lookup/friend9.C: New test.
PR c++/25625
* g++.dg/template/repo5.C: New test.
From-SVN: r109307
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 8 | ||||
-rw-r--r-- | gcc/cp/repo.c | 6 |
3 files changed, 25 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4c03812..9102cbc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2006-01-03 Mark Mitchell <mark@codesourcery.com> + + PR c++/25492 + * name-lookup.c (push_class_level_binding): When a derived class + provides a type binding, eliminate any type binding from a base + class. + + PR c++/25625 + * repo.c (repo_emit_p): Always instantiate static data members + initialized by constant expressions, so that there values are + available. + 2006-01-02 Mark Mitchell <mark@codesourcery.com> PR c++/25635 diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index dcd20f7..ec662e6 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2669,7 +2669,13 @@ push_class_level_binding (tree name, tree x) INHERITED_VALUE_BINDING_P (binding) = 0; } else - old_decl = bval; + { + old_decl = bval; + /* Any inherited type declaration is hidden by the type + declaration in the derived class. */ + if (TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)) + binding->type = NULL_TREE; + } } else if (TREE_CODE (x) == OVERLOAD && is_overloaded_fn (bval)) old_decl = bval; diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index d2fae3e..ad01010 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -298,6 +298,12 @@ repo_emit_p (tree decl) && (!TYPE_LANG_SPECIFIC (type) || !CLASSTYPE_TEMPLATE_INSTANTIATION (type))) return 2; + /* Static data members initialized by constant expressions must + be processed where needed so that their definitions are + available. */ + if (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) + && DECL_CLASS_SCOPE_P (decl)) + return 2; } else if (!DECL_TEMPLATE_INSTANTIATION (decl)) return 2; |