diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-08-24 01:27:34 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-08-24 01:27:34 +0200 |
commit | 97dc8e5b5775cbb4aba4a7d7456844c15ad5d6b0 (patch) | |
tree | 678f401110fa2b1d462caa8ea4f40e088161b2d8 /gcc | |
parent | 9b21a3805360cf92d94c3767743f85f992f8293d (diff) | |
download | gcc-97dc8e5b5775cbb4aba4a7d7456844c15ad5d6b0.zip gcc-97dc8e5b5775cbb4aba4a7d7456844c15ad5d6b0.tar.gz gcc-97dc8e5b5775cbb4aba4a7d7456844c15ad5d6b0.tar.bz2 |
re PR c++/32898 (Definition of variable N::i outside namespace N not rejected)
PR c++/32898
* name-lookup.c (set_decl_namespace): lookup_qualified_name failure
is error_mark_node rather than NULL_TREE.
* pt.c (check_explicit_specialization): Likewise.
* g++.dg/lookup/ns3.C: New test.
From-SVN: r127749
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 2 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/ns3.C | 5 |
5 files changed, 17 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 19c149d..e39c0a1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2007-08-24 Jakub Jelinek <jakub@redhat.com> + PR c++/32898 + * name-lookup.c (set_decl_namespace): lookup_qualified_name failure + is error_mark_node rather than NULL_TREE. + * pt.c (check_explicit_specialization): Likewise. + PR c++/31941 * error.c (resolve_virtual_fun_from_obj_type_ref): Handle TARGET_VTABLE_USES_DESCRIPTORS targets properly. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 5f7e718..c6628aa 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2970,7 +2970,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp) /* See whether this has been declared in the namespace. */ old = lookup_qualified_name (scope, DECL_NAME (decl), false, true); - if (!old) + if (old == error_mark_node) /* No old declaration at all. */ goto complain; if (!is_overloaded_fn (decl)) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b4a9b68..2594e7d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1980,7 +1980,7 @@ check_explicit_specialization (tree declarator, context. */ fns = lookup_qualified_name (CP_DECL_CONTEXT (decl), dname, false, true); - if (!fns || !is_overloaded_fn (fns)) + if (fns == error_mark_node || !is_overloaded_fn (fns)) { error ("%qD is not a template function", dname); fns = error_mark_node; @@ -2215,6 +2215,8 @@ check_explicit_specialization (tree declarator, /* This specialization has the same linkage and visibility as the function template it specializes. */ TREE_PUBLIC (decl) = TREE_PUBLIC (tmpl_func); + if (! TREE_PUBLIC (decl) && DECL_INTERFACE_KNOWN (tmpl_func)) + DECL_INTERFACE_KNOWN (decl) = 1; DECL_THIS_STATIC (decl) = DECL_THIS_STATIC (tmpl_func); if (DECL_VISIBILITY_SPECIFIED (tmpl_func)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b004d09..5c35247 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2007-08-24 Jakub Jelinek <jakub@redhat.com> + PR c++/32898 + * g++.dg/lookup/ns3.C: New test. + * gfortran.dg/assumed_charlen_sharing.f90: New test. PR c++/31941 diff --git a/gcc/testsuite/g++.dg/lookup/ns3.C b/gcc/testsuite/g++.dg/lookup/ns3.C new file mode 100644 index 0000000..144cba7 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/ns3.C @@ -0,0 +1,5 @@ +// PR c++/32898 + +namespace N { } + +int N::i; // { dg-error "should have been declared inside" } |