+2001-02-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (lookup_template_class): Make sure it's a primary
+ template or template_template_parm when called from the parser.
+ (instantiate_template_class): Add assertion.
+
2001-02-05 Alexandre Oliva <aoliva@redhat.com>
* method.c (build_mangled_name) [old abi]: Protect flush_repeats()
return error_mark_node;
}
- if (TREE_CODE (template) != TEMPLATE_DECL)
+ if (TREE_CODE (template) != TEMPLATE_DECL
+ /* If we're called from the parser, make sure it's a user visible
+ template. */
+ || ((!arglist || TREE_CODE (arglist) == TREE_LIST)
+ && !DECL_TEMPLATE_PARM_P (template)
+ && !PRIMARY_TEMPLATE_P (template)))
{
if (complain)
{
tree newtag;
newtag = tsubst (tag, args, /*complain=*/1, NULL_TREE);
+ my_friendly_assert (newtag != error_mark_node, 20010206);
if (TREE_CODE (newtag) != ENUMERAL_TYPE)
{
if (TYPE_LANG_SPECIFIC (tag) && CLASSTYPE_IS_TEMPLATE (tag))
+2001-02-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.pt/spec39.C: New test.
+
2001-02-05 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20010202-1.c: New test.
--- /dev/null
+// Build don't link:
+//
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 19 Jan 2001 <nathan@codesourcery.com>
+
+// Bug 1656. We failed to make sure that a template-id was built
+// from a primary template.
+
+template <int dim> struct Outer
+{
+ struct Inner {};
+
+ void f()
+ {
+ Inner<dim> i; // ERROR - non-template
+ Inner<> j; // ERROR - non-template
+ }
+};
+struct O {};
+void foo ()
+{
+ Outer<1> x;
+ x.f ();
+ Outer<1>::Inner<2> z; // ERROR - non-template
+ O<1> w; // ERROR - non-template
+}
+
+template <typename T, template <typename C> class TPL>
+struct X
+{
+ TPL<T> t;
+ T<int> s; // ERROR - non-template
+};
+
+template <typename T> struct Y
+{
+};
+
+void bar ()
+{
+ X<int, Y> a;
+ X<int, O> b; // ERROR - non-template
+}