aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-08-24 14:57:50 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-08-24 14:57:50 -0400
commit60b5de49ef8049c7d6d48130cb501cc97794b6ad (patch)
treef3394b3c598b11bdffcbd2eae88e815c89b04f56 /gcc/cp
parent013734b91bc257a1f03f2e94dca9efa1b94e39c9 (diff)
downloadgcc-60b5de49ef8049c7d6d48130cb501cc97794b6ad.zip
gcc-60b5de49ef8049c7d6d48130cb501cc97794b6ad.tar.gz
gcc-60b5de49ef8049c7d6d48130cb501cc97794b6ad.tar.bz2
pt.c (register_specialization): Correct argument to check_specialization_namespace.
* pt.c (register_specialization): Correct argument to check_specialization_namespace. (determine_specialization): Don't consider members of unspecialized types. From-SVN: r190652
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c14
2 files changed, 19 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0c89111..9eb4b87 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2012-08-24 Jason Merrill <jason@redhat.com>
+
+ * pt.c (register_specialization): Correct argument to
+ check_specialization_namespace.
+ (determine_specialization): Don't consider members of
+ unspecialized types.
+
2012-08-23 Jason Merrill <jason@redhat.com>
* decl.c (compute_array_index_type): Use type_dependent_expression_p.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ad81bab..580a3d4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -735,7 +735,7 @@ end_explicit_instantiation (void)
processing_explicit_instantiation = false;
}
-/* An explicit specialization or partial specialization TMPL is being
+/* An explicit specialization or partial specialization of TMPL is being
declared. Check that the namespace in which the specialization is
occurring is permissible. Returns false iff it is invalid to
specialize TMPL in the current namespace. */
@@ -1407,7 +1407,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
DECL_SOURCE_LOCATION (clone)
= DECL_SOURCE_LOCATION (fn);
}
- check_specialization_namespace (fn);
+ check_specialization_namespace (tmpl);
return fn;
}
@@ -1804,6 +1804,16 @@ determine_specialization (tree template_id,
if (template_id == error_mark_node || decl == error_mark_node)
return error_mark_node;
+ /* We shouldn't be specializing a member template of an
+ unspecialized class template; we already gave an error in
+ check_specialization_scope, now avoid crashing. */
+ if (template_count && DECL_CLASS_SCOPE_P (decl)
+ && template_class_depth (DECL_CONTEXT (decl)) > 0)
+ {
+ gcc_assert (errorcount);
+ return error_mark_node;
+ }
+
fns = TREE_OPERAND (template_id, 0);
explicit_targs = TREE_OPERAND (template_id, 1);