summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-09 18:05:29 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-09 18:05:29 +0000
commitc354ae4737a4b73d1e00a9b0c1e13f30c777529c (patch)
treef21f7dbe8cfd281fd8ad88b0fd2ea707f065a5ab
parent3be4750cb69598ff17cbcac1e38c617bcd78cc4a (diff)
downloadgcc-c354ae4737a4b73d1e00a9b0c1e13f30c777529c.tar.gz
PR c++/63309
* parser.c (cp_parser_class_head): push_template_decl for members of templates, too. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216044 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c4
-rw-r--r--gcc/testsuite/g++.dg/template/nested6.C19
3 files changed, 24 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 09aad7db461..cf04f0dd704 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2014-10-09 Jason Merrill <jason@redhat.com>
+ PR c++/63309
+ * parser.c (cp_parser_class_head): push_template_decl for members
+ of templates, too.
+
PR c++/63415
* pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type.
(iterative_hash_template_arg): Likewise.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index bc992b20045..a9edcd53df4 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -20222,9 +20222,7 @@ cp_parser_class_head (cp_parser* parser,
template either from the template headers or the type we're
defining, so that we diagnose both extra and missing headers. */
if ((PROCESSING_REAL_TEMPLATE_DECL_P ()
- || (CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (type))
- && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE
- (TREE_TYPE (type)))))
+ || CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (type)))
&& !CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (type)))
{
type = push_template_decl (type);
diff --git a/gcc/testsuite/g++.dg/template/nested6.C b/gcc/testsuite/g++.dg/template/nested6.C
new file mode 100644
index 00000000000..f5b8054a592
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/nested6.C
@@ -0,0 +1,19 @@
+// PR c++/63309
+
+template <class T>
+class A
+{
+public:
+ class B;
+};
+
+template <class T, class I>
+class A<T>::B // { dg-error "template parameters|required" }
+{
+};
+
+int main()
+{
+ A<int>::B myB; // { dg-prune-output "incomplete type" }
+ return 0;
+}