commit 65f6fa41abaf6f9829b7aee62524c9d92f0c2ce3
Author: Jason Merrill <jason@redhat.com>
Date: Wed Oct 8 21:53:55 2014 -0400
PR c++/63309
* parser.c (cp_parser_class_head): push_template_decl for members
of templates, too.
@@ -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);
new file mode 100644
@@ -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;
+}